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

eglot-extend-to-xref shouldn't activate Eglot in files other than the managed modes #1275

Open
sg-qwt opened this issue Aug 20, 2023 · 1 comment

Comments

@sg-qwt
Copy link

sg-qwt commented Aug 20, 2023

https://github.com/sg-qwt/debuglsp

  1. run nix develop to start a devshell
  2. run emacs-bad inside that devshell
  3. hover on one of the java class in the clojure file and xref-find-definitons on it
  4. in the minimal emacs eglot+clojure-lsp setup(./emacs-bad/init.el), eglot-extend-to-xref is set to t
  5. when jumped to java source, you can see eglot enabled on the destination java file even though I've got nothing setup for java lsp and with no eglot-ensure on java-mode.

I'd expect eglot-extend-to-xref shoud only work (as extend) for whatever mode I've setup for. In this case, I've only setup a hook for clojure-lsp with clojure-mode on eglot-ensure for example. But as long as I enabled eglot-extend-to-xref and jump definiton from the clojure source file to java source file, eglot is enabled(extended) to this java source file.

But that's unexpected and not desired this case: a. Because I don't have any java lsp installed and setup b. clojure-lsp won't work on java source file.

Better document why eglot-extend-to-xref would extend on unsetup mode or just let eglot-extend-to-xref extend itself to some new mode(from clojure mode to java mode this case) behave same as it'd prompt you to install java lsp as if you just open a fresh java file without setup lsp/eglot this case.

cross ref: clojure-lsp/clojure-lsp#1656

@joaotavora
Copy link
Owner

I think I get it, no need to reproduce (recipes based on nix are fairly useless to me anyway).

This is unusual though, as most servers link to files in the same language. I guess some extra checks for the eglot-extend-to-xref behavior can be added.

@joaotavora joaotavora changed the title eglot-extend-to-xref unexpected bahavior eglot-extend-to-xref shouldn't activate Eglot in files other than the managed modes Aug 20, 2023
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

2 participants