Skip to content

clojure-lsp: not working via Tramp #4745

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

Open
3 tasks done
jkxyz opened this issue Mar 29, 2025 · 4 comments
Open
3 tasks done

clojure-lsp: not working via Tramp #4745

jkxyz opened this issue Mar 29, 2025 · 4 comments
Labels

Comments

@jkxyz
Copy link

jkxyz commented Mar 29, 2025

Thank you for the bug report

  • I am using the latest version of lsp-mode related packages.
  • I checked FAQ and Troubleshooting sections
  • You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain

Bug description

When using clojure-lsp in a Tramp remote buffer, I'm observing the following behavior:

  1. The LSP server successfully starts and connects on the remote host
  2. Project diagnostics are correctly displayed in the modeline
  3. Code actions like "Move to let" work as expected
  4. Navigation functions like lsp-find-definition and lsp-describe-thing-at-point all fail to work, reporting that the symbol cannot be found, or displaying an empty help buffer

I've tested this on the sshx tramp method, and a custom wsl method.

Steps to reproduce

  1. Navigate to a remote Clojure file using Tramp, e.g. with the Tramp path /sshx:localhost:proj/foo.clj
  2. M-x lsp
  3. Once the server has started, observe that lsp-find-references and other functions don't work

Expected behavior

The LSP client should work seamlessly over Tramp.

Which Language Server did you use?

clojure-lsp

OS

Windows

Error callstack

Anything else?

It's worth noting that clojure-lsp works well with Eglot over Tramp.

@jkxyz jkxyz added the bug label Mar 29, 2025
@ericdallo
Copy link
Member

@jkxyz I believe this is a clojure-lsp issue as I never dedicated time to make it remote filesystem aware, it's pretty coupled with local files unfortunatelly

@jkxyz
Copy link
Author

jkxyz commented Mar 31, 2025

I don't know if it's a clojure-lsp issue, since all these features do work fine when using Eglot as the LSP client. And I doubt that Eglot has any special handling for clojure-lsp or any LSP server in particular. I think that in some cases lsp-mode is failing to translate between the remote and local paths that are being sent to and received from the server. The LSP server still runs on the remote host and treats the files as local, so it shouldn't be expected to change anything there.

@jkxyz
Copy link
Author

jkxyz commented Mar 31, 2025

If the Emacs buffer has a path like /sshx:josh@123.456.789.123:Code/proj/foo.clj, then lsp-mode needs to know that the project root has an absolute path like /sshx:josh@123.456.789.123:/home/josh/Code/proj, and initialize clojure-lsp on the remote host using the local path for the root, /home/josh/Code/proj, and then also translate project file paths to local paths relative to the root I guess, so foo.clj. I think that probably this translation is failing somewhere.

@ericdallo
Copy link
Member

one way to debug that is get logs between client <-> server, more info here

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

No branches or pull requests

2 participants