Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions: Find definition from libraries installed in container #21

Open
ztlevi opened this issue May 17, 2020 · 5 comments
Open

Questions: Find definition from libraries installed in container #21

ztlevi opened this issue May 17, 2020 · 5 comments

Comments

@ztlevi
Copy link

ztlevi commented May 17, 2020

It seems like we are not able to jump to definitions where the source codes are installed as libraries in the docker container. For example, jump to native python libraries.

I'm not sure how to make this happen. So I tried to open emacs in the docker container with emacslsp/lsp-docker-full, then of course, we could jump to that definition.

But I got another question. How to start emacs as gui from docker? There must some command line args that I don't know and I need to pass to enable gui...

So sum up the two question:

  1. Can I open emacs on desktop and use lsp-docker to find definitions from the libraries installed in the docker container?
  2. Can we open emacs from docker in gui?

I have a minimal test repo over here which contains the minimal reproduce steps https://github.com/ztlevi/lsp-docker-test

@yyoncho
Copy link
Member

yyoncho commented May 17, 2020

  1. I don't have the time to test it now but this should work. Can you describe what exactly happens and add the logs?

  2. I run

 xhost +

and then it works.

@ztlevi
Copy link
Author

ztlevi commented May 17, 2020

  1. I use the repo I attach above and try lsp-jump-to-definition to Deque from from typing import Deque. Then it gives me:
  signal(cl-no-applicable-method (xref-item-location nil))
  cl-no-applicable-method(#s(cl--generic :name xref-item-location :dispatches ((0 #s(cl--generic-generalizer :name eieio--gen$
  apply(cl-no-applicable-method #s(cl--generic :name xref-item-location :dispatches ((0 #s(cl--generic-generalizer :name eiei$
  #f(compiled-function (&rest args) #<bytecode 0x1638e45>)(nil)
  apply(#f(compiled-function (&rest args) #<bytecode 0x1638e45>) nil nil)
  xref-item-location(nil)
  xref--pop-to-location(nil nil)
  xref--show-xrefs(nil nil)
  lsp-show-xrefs(nil nil nil)
  lsp-find-locations("textDocument/definition" nil :display-action nil)
  lsp-find-definition()
  funcall-interactively(lsp-find-definition)
  call-interactively(lsp-find-definition record nil)
  command-execute(lsp-find-definition record)
  execute-extended-command(nil "lsp-find-definition" "lsp-find-def")
  funcall-interactively(execute-extended-command nil "lsp-find-definition" "lsp-find-def")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)
  1. How did you run xhost +? I run it on my local shell and run start-emacs.sh, but emacs is still start in terminal.

@zflat
Copy link
Contributor

zflat commented May 19, 2021

I have the same question. I try lsp-find-reference and get this error

Warning (lsp-mode): Failed to process xref entry for filename ’/docker:my-docker-langservers:/opt/ros/melodic/include/rosconsole/macros_generated.h’: Method ‘docker’ is not known.

The file path is known and correct within the container. Is there any way to open that file in an emacs buffer? Ideally it would still work with lsp-mode to facilitate further navigation.

If that is not possible, could there be a way to open the buffer using Tramp? In my case, changing the file path from /docker:my-docker-langserver:/opt/... to /ssh:user@host#port:/opt/... would work when the container is running sshd.

@yyoncho
Copy link
Member

yyoncho commented May 20, 2021

@zflat can you try installing docker-tramp package?

@zflat
Copy link
Contributor

zflat commented May 22, 2021

Yes, that is the fix for handling the xref uri. However, I now have this issue: #29

I have a branch that I am using to test a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants