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

LSP: Unknown method textDocument/didSave #36464

Closed
tophattom opened this issue Apr 3, 2019 · 7 comments
Closed

LSP: Unknown method textDocument/didSave #36464

tophattom opened this issue Apr 3, 2019 · 7 comments
Labels
analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.

Comments

@tophattom
Copy link

When using the analysis server in LSP mode together with Sublime Text LSP plugin I get an error Unknown method textDocument/didSave every time I save a file.

  • Dart VM version: 2.1.2-dev.0.0.flutter-0a7dcf17eb (Tue Feb 12 01:59:15 2019 +0000) on "macos_x64"
@kevmoo kevmoo added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Apr 3, 2019
@bwilkerson
Copy link
Member

@DanTup

@DanTup
Copy link
Collaborator

DanTup commented Apr 4, 2019

@tophattom This sounds like the same issue I reported in the Vim plugin here: natebosch/vim-lsc#164

My understanding is that LSP clients should not send textDocument/didSave if ServerCapabilities. textDocumentSync does not contain the optional save field:

export interface TextDocumentSyncOptions {
	/**
	 * Save notifications are sent to the server.
	 */
	save?: SaveOptions;
}

It's not clear which Sublime LSP plugin you're using, but I think this should be raised there. I'll also open an issue against the LSP spec asking for clarification of this, since it's the second time I've seen it - I don't think the spec is as clear as it could be whichever way it should be.

@tophattom
Copy link
Author

Oh, I see. Thanks! I'll open an issue in https://github.com/tomv564/lsp then.

@DanTup
Copy link
Collaborator

DanTup commented Apr 4, 2019

@tophattom Great - feel free to CC me in the issue or post the link back here. I've opened microsoft/language-server-protocol#713 to try and have the spec made clearer (there is a table at microsoft/language-server-protocol#288 (comment) which matches my understanding, it's just not as clear from the spec).

I'll close this for now since I don't think there's anything for us to do, but we can revisit if that turns out to be incorrect.

Thanks!

@DanTup
Copy link
Collaborator

DanTup commented Apr 4, 2019

@tophattom Btw, if you've managed to get this all working well, it might be worth having some notes shared somewhere (for ex. we have Vim instructions linked at https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/tool/lsp_spec/README.md#using-the-dart-lsp-server-in-editors). There was also a request for Sublime Flutter support, so the author of flutter/flutter#29915 might be interested to know what you had to do to set it up (I posted some notes from managing to get it somewhat-working, but I'm not a Sublime so I'm not sure what I did was a good way to do it).

@tophattom
Copy link
Author

Actually, I just copied your configuration from that thread. This didSave error was so annoying that I had to disable the server for now so didn't get to play around with it that much. Seemed to work fine, though. But I'll try to write more instructions if I ever figure more stuff out!

@DanTup
Copy link
Collaborator

DanTup commented Apr 4, 2019

Actually, I just copied your configuration from that thread.

Ah 😁

Unfortunately there's no quick fix for the didSave issue in the server (unless you wanted to implement an empty handler and run the server from source). If you can modify the source of the LSP extension, probably you could just comment this line out (though it would apply to other LSP implementations you're using too):

https://github.com/tomv564/LSP/blob/263b5b30b0744d777a3bdfb77aa174abf6b1664b/plugin/core/windows.py#L234

Hopefully it'll be sorted properly in the client soon. Do shout if you hit any other issues that might be related to the server though :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
Projects
None yet
Development

No branches or pull requests

4 participants