-
Notifications
You must be signed in to change notification settings - Fork 3
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
Send structured InitializationOptions
to the server
#121
Conversation
In particular, this lets us respect `air.logLevel` and `air.dependencyLogLevels` on server startup User and workspace level settings are not used yet but are included for completeness
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you know about handle_initialized()
in handlers.rs? We already have some infra in place for dynamic watching of settings. Probably worth making these dynamic now?
"properties": { | ||
"air.logLevel": { | ||
"default": null, | ||
"markdownDescription": "Controls the log level of the language server.\n\n**This setting requires a restart to take effect.**", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These static settings are a bit annoying. Probably worth it to make it dynamic right away?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to do in a follow up after we rework testing a bit to allow for dynamicness in the logging code
Closes #100
This PR sends a minimal amount of initialization options through
initializationOptions
-logLevel
anddependencyLogLevels
. These are currently our only 2 client side options, but the important part is that they really are initialization time options.For 99% of client side options, this isn't really the right thing to do. We are instead supposed to "pull" options dynamically on the server side. We would do that at startup and after any meaningful change notification (workspace changes, configuration changes, etc). See microsoft/language-server-protocol#567 for a big discussion about this. Note that I don't think ruff really does this correctly.
If we ever wanted
logLevel
to be dynamic, it would come throughinitializationOptions
AND also be "pull"ed dynamically (as a way to refresh it).Here are the places we might dynamically "pull" options in the future (once we have user/workspace level options)
-
Initialized
notification handler, where we'd request them for the first time (possibly also adding a lock to prevent any other requests from running until we've requested them and set them)-
DidChangeWorkspaceFolders
, requesting them for opened workspaces, purging them for closed workspaces-
DidChangeConfiguration
, where we useDidChangeConfiguration
as a simple notification that "something" has changed in configuration, so we have to repull every scope we are interested in (this is now how you are supposed to useDidChangeConfiguration
apparently)