-
Notifications
You must be signed in to change notification settings - Fork 92
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
Remove configuration aspect from onInitialConfiguration? #253
Comments
Agree, when working in the config acess in |
If vscode sends a |
What I have so far looks like: -- | Contains all the callbacks to use for initialized the language server.
-- it is parameterized over a config type variable representing the type for the
-- specific configuration data the language server needs to use.
data InitializeCallbacks config =
InitializeCallbacks
{ onConfigurationChange :: J.Value -> LspM config (Either T.Text config)
-- ^ @onConfigurationChange newConfig@ is called whenever the
-- clients sends a message with a changed client configuration. This
-- callback should return either the parsed configuration data or an error
-- indicating what went wrong. The parsed configuration object will be
-- stored internally and can be accessed via 'config'.
, onInitialization :: InitializeRequest -> LspM config (Maybe ResponseError)
-- ^ Called after receiving the initialization request and before returning the response.
-- This callback will be invoked to offer the language server
-- implementation the chance to create any processes or start new threads
-- that may be necesary for the server lifecycle.
-- It can also return an error in the initialization if necessary.
} |
The intention behind the init is you may be using it for one-time startup stuff. And there is no guarantee that they should be the same, so we should allow them to be different. That said, command line args to launch the server are probably the best way to actually pass init options. |
Fixed in #244 |
A lot of servers seem to be using
initializationOptions
in theinitialize
request to pass the workspace configuration in, but see the discussion here microsoft/language-server-protocol#567 and the official recommendation here:microsoft/language-server-protocol@545cd69
It looks like they are indeed separate things, and that
initializationOptions
is more for command line arguments etc. However our API currently suggests that they should be treated the same, by providing a callback to extract the workspace configuration frominitializationOptions
and store it in theresConfig
state.To me it seems like the
resConfig
state should be used to keep track of the most recentworkspace/didChangeConfiguration
notifications exclusively (and we should extend this to be updated whenever aworkspace/configuration
request is made from the server).Should we change
onInitialConfiguration
to something more like:to guide server authors down the right path. This
LspM
monad is from the type safe branch in #244. If authors still need to get the workspace configuration immediately after initialization, then inLspM
they can make aworkspace/configuration
request to pull it from the client.The text was updated successfully, but these errors were encountered: