go-langserver icon indicating copy to clipboard operation
go-langserver copied to clipboard

Support dynamic registration for formatting

Open geonilpark opened this issue 7 years ago • 8 comments

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

geonilpark avatar Dec 09 '17 00:12 geonilpark

I'm not quite sure what you want to achieve. Do you want the langserver to not have DocumentFormattingProvider set to true?

keegancsmith avatar Dec 11 '17 06:12 keegancsmith

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..

geonilpark avatar Dec 11 '17 18:12 geonilpark

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?

keegancsmith avatar Dec 11 '17 20:12 keegancsmith

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. :)

geonilpark avatar Dec 15 '17 18:12 geonilpark

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.

keegancsmith avatar Dec 16 '17 04:12 keegancsmith

@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 avatar Nov 06 '21 13:11 pawansingh00

@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 avatar Nov 08 '21 07:11 keegancsmith

@keegancsmith Thanks for pointing me to right direction, will check there.

pawansingh00 avatar Nov 08 '21 07:11 pawansingh00