go-langserver
go-langserver copied to clipboard
Support dynamic registration for formatting
Hi,
I would like to set DocumentFormattingProvider dynamically between my editor and go-language-server without reinitializing.
I appreciated if this is possible or how to do that.
Thanks, Geonil
I'm not quite sure what you want to achieve. Do you want the langserver to not have DocumentFormattingProvider set to true?
I have a requirement to enable/disable DocumentFormattingProvider depending on a criteria - database version. So, if version > 20 then enable otherwise disable. So, I would like to override DocumentFormattingProvider after initialize..
LSP does not provide a way to turn this functionality off dynamically. I'm not sure what editor you use, but it may make sense for you to implement this sort of logic in the editor. IE go-langserver supports formatting. If you don't want to format just don't send the format calls. Not sending the format calls is the responsibility of the editor or plugin or user.
Does that sound reasonable, or am I possibly misunderstanding you?
I see. So, LSP is not yet ready for "client/registerCapability" for overriding current setting? I am using monaco-editor and I made a workaround by passing initializationOptions param which is static setting for DocumentFormattingProvider at initialize. Thank you, again. :)
Sorry you are correct. We don't support client/registerCapability so I hadn't read up about it to understand your question. I'm turning this question into a feature request.
@geonilpark Hi, Can you please give me any pointer on how to get started with Integrating Monaco Editor with this language server.
Thanks, Pawan
@pawansingh00 this language server is quite old and not actively maintained. If you want go support I recommend looking at gopls which is supported by the Go team.
@keegancsmith Thanks for pointing me to right direction, will check there.