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

Fix lsp-mode's tramp support #4204

Merged
merged 2 commits into from Nov 1, 2023
Merged

Fix lsp-mode's tramp support #4204

merged 2 commits into from Nov 1, 2023

Conversation

yyoncho
Copy link
Member

@yyoncho yyoncho commented Oct 27, 2023

Fix lsp-mode's tramp support

  • This fixes the implementation of lsp-mode tramp support. After this PR the
    remote clients will be automatically registered and in most of the cases it will
    work out of the box. The remote connection is managed to a way similar to what
    eglot does.

Fixes #4158
Fixes #4150
Fixes #4158
Fixes #4150
Fixes #3841
Fixes #3642
Fixes #3579
Fixes #3530
Fixes #3491
Fixes #3490
Fixes #3391
Fixes #3369
Fixes #3364
Fixes #3020
Fixes #3018
Fixes #3020

Comment on lines -34 to +15

`lsp-mode` detects whether a particular file is located on remote machine and looks for a client which matches current file and it is marked as `:remote?` t. Then `lsp-mode` starts the client through tramp. By default `lsp-mode` will copy the local client and mark it as `remote? t`. In most of the cases it is good enough but certain cases this may not work (e. g. if the server configuration contains references to local paths). In this case the user is supposed to create `.dir-local` configuration to override the references to local paths or open an issue on `lsp-mode` side to make the setting remote agnostic. To turn of automatic remote clients registration you can set `lsp-auto-register-remote-clients` to `nil`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yyoncho A small typo here "To turn off" (instead of "To turn of").

But as a side note I've applied this patch and it's been working nicely for my use cases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sochotnicky thank you, will be applied before merging.

@sochotnicky
Copy link

While testing this out, I realized that if the local side has the LSP server installed but remote does not, this will fail with a bit of cryptic message (lsp server failed to start do you want to restart etc). Inspecting the logs it looks like the attempt was to start a server that didn't exist remotely.

Not sure if you'd want to tackle that one here or perhaps a separate PR.

- This fixes the implementation of `lsp-mode` tramp support. After this PR the
remote clients will be automatically registered and in most of the cases it will
work out of the box. The remote connection is managed to a way similar to what
eglot does.

Fixes emacs-lsp#4158
Fixes emacs-lsp#4150
Fixes emacs-lsp#4158
Fixes emacs-lsp#4150
Fixes emacs-lsp#3841
Fixes emacs-lsp#3642
Fixes emacs-lsp#3579
Fixes emacs-lsp#3530
Fixes emacs-lsp#3491
Fixes emacs-lsp#3490
Fixes emacs-lsp#3391
Fixes emacs-lsp#3369
Fixes emacs-lsp#3364
Fixes emacs-lsp#3020
Fixes emacs-lsp#3018
Fixes emacs-lsp#3020
@yyoncho
Copy link
Member Author

yyoncho commented Oct 30, 2023

@sochotnicky pushed a fix for this issue. Please let me know if it works for you. Thank you for testing it out.

@yyoncho yyoncho merged commit d45aca0 into emacs-lsp:master Nov 1, 2023
12 of 14 checks passed
yyoncho added a commit that referenced this pull request Nov 1, 2023
yyoncho added a commit that referenced this pull request Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment