Open bzoracler opened 3 weeks ago
Could you create a PR please
I think a default behaviour should be implemented when section is not specified - such as (1) returning the entire configuration object, which is my preference, or (2) returning null.
It would be nice to clarify that. Could you create an issue at https://github.com/microsoft/vscode-languageserver-node/issues please.
TL;DR the LSP specs leave the behaviour undefined, so the decision is up to LSP4IJ on what to do upon a null
section request (but definitely not raise an exception). LSP4IJ must handle a null
section, and IMO it should:
null
is provided as the section;null
;From the specification (emphases mine):
A
ConfigurationItem
consists of the configuration section to ask for and an additional scope URI. The configuration section asked for is defined by the server and doesn’t necessarily need to correspond to the configuration store used by the client. So a server might ask for a configurationcpp.formatterOptions
but the client stores the configuration in an XML store layout differently. It is up to the client to do the necessary conversion.
I interpret this as: The server must advertise what section it's going to request (such as null
), and a compatible client must handle it. So, if the server requests a null
section, it's up to the client what to return to the server; what the server/client should do for any particular configuration section (including null
) isn't specified by the language server protocol.
In light of this, whether null
is a sensible request from the server or not depends on the client; for generic clients which can configure one of multiple servers using a shared configuration file (e.g. VS Code's settings.json
), it doesn't make sense for null
to return the entire configuration as it would contain irrelevant items. LSP4IJ's user-defined Langauge Server UI isolates each language server with their own configuration settings, so returning the entire configuration may be a sensible interpretation if the server asks for null
. However, since the server must advertise what it asks for, if the server advertises that it asks for null
, it may not be generically compatible with other clients, but that's the server's implementation problem, not the client's.
See also some discussion about the uncertainty of what section
means in https://github.com/microsoft/language-server-protocol/issues/972.
When retrieving configuration settings through
workspace/configuration
, the language server specifications allows leavingsection
unspecified:However, if
section
is not provided, LSP4IJ raises an exception1.I think a default behaviour should be implemented when
section
is not specified - such as (1) returning the entire configuration object, which is my preference, or (2) returningnull
.com.redhat.devtools.lsp4ij.client.LanguageClientImpl.findSettings
Stack trace: https://github.com/redhat-developer/lsp4ij/blob/6a561e0c274211141a36b1c0eeeb1d3a056f1670/src/main/java/com/redhat/devtools/lsp4ij/client/LanguageClientImpl.java#L227