LanguageClient-neovim icon indicating copy to clipboard operation
LanguageClient-neovim copied to clipboard

Don't send textDocument/didSave unless server advertises support for it

Open chenguanda opened this issue 5 years ago • 7 comments

More information: dart-lang/sdk#36464 natebosch/vim-lsc#164 tomv564/LSP#550

I use the follow config

let g:LanguageClient_serverCommands = {
    \ 'python' :["pyls"],
    \ 'rust': ['rustup', 'run', 'stable', 'rls'],
    \ 'dart': ['$DART_SDK/dart', "$DART_SDK/snapshots/analysis_server.dart.snapshot", "--lsp"],
\ }

while I try to save a dart file, I get a error

[LC] [Error] Unknown method textDocument/didSave%

chenguanda avatar Jun 11 '19 14:06 chenguanda

Is there a way to disable this for a given language explicitly in LanguageClient configuration? reading docs did not yield any useful information on this matter.

Cheers

Gonzih avatar Jan 31 '21 21:01 Gonzih

Not yet. It should be fairly simple to implement though so if someone is willing to open a PR I would be happy to help and merge. Otherwise I should be able to have a commit ready for this in a few days.

martskins avatar Jan 31 '21 21:01 martskins

Does anyone have an example of a server that does not advertise support for this? I have something ready-ish but would like to try it out first before pushing any changes.

martskins avatar Feb 02 '21 19:02 martskins

@martskins dart server has this issue, once you installed dart you can run it with dart "$DART_SDK/bin/snapshots/analysis_server.dart.snapshot" --lsp. LC config:

let g:LanguageClient_serverCommands = {
\ 'dart': ['dart', $DART_SDK.'/bin/snapshots/analysis_server.dart.snapshot', '--lsp'],
\ }

Gonzih avatar Feb 02 '21 21:02 Gonzih

Opened #1188 to fix this. It will only send the notification if the server advertised support for it. I tried it with dart and it seemed to work, but if someone else can give that PR a try that would be great.

martskins avatar Feb 03 '21 21:02 martskins

Merged #1188. It's not available on the next branch yet, we need to cut a release for it to be officially fixed, but if any of you are using the dev branch you should see it fixed.

martskins avatar Feb 06 '21 11:02 martskins

Thanks for the fix @martskins !

Gonzih avatar Feb 06 '21 15:02 Gonzih