Skip to content
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

Overhaul server configuration #679

Merged
merged 20 commits into from
Nov 18, 2023
Merged

Conversation

alcarney
Copy link
Member

@alcarney alcarney commented Nov 10, 2023

This introduces a dedicated component responsible for managing the server's configuration, reacting to changes in configuration and notifying subscribers of any changes.

Configuration can be read from the following sources, in order of descending precedence

  • Initialization options (discouraged for multi-root scenarios)
  • workspace/configuration
  • pyproject.toml files

When supported by the client, the server can detect changes to configuration and respond automatically to (most) changes

Closes #527

The idea is that all configuration will be managed in a centralised
location. The `WorkspaceConfiguration` component will be attached to the
main language server will be responsible from merging configuration
values from a number of sources.

- Initialization options
- ``workspace/configuration`` requests
- Configuration files

While this is not implemented yet, this component will also make sure
that the configuration values are kept up to date. Eventually features
will be able to subscribe to changes in the sections that they are
interested in.
Upon receiving the `initialized` notification the server dynamically
registers to receive `workspace/didChangeConfiguration` notifications,
if the client supports it.

The server will also early request the entire `esbonio` configuration
section for each workspace root and the global config so that it's ready
to serve internal configuration requests from features.

This commit also updates the old uses of `server.get_user_config` to use
the new `server.configuration.get` API
Rather than have the logging setup be anything "special", it is now just
another LanguageFeature allowing it to take advantage of the APIs
provided to them.
To align with the changes in how the server asks for configuration
values, this updates and simplifies the code that injects the user's
configured Python environment into returned configuration.
`lsp-devtools` is too heavy a dependency to bundle for it to be worth
it, especially when you consider the proportion of users who are
actually going to make use of it.

Instead, the extension now assumes that it is available on the user's
PATH
Since the language server treats `workspace/configuration` requests as
an override for any options set via config file, it's now important to
only send the options that the user has actually set.

This means most config options in the VSCode extension are now `null` by
default.
Options are read from the `tool.esbonio` namespace
For clients that support it, the language server will be able to listen
for changes to `pyproject.toml` files and update its configuration
accordingly.
- Move to reference section
- Add a custom domain to document esbonio
- Explain the updated configuration behavior
@alcarney alcarney merged commit 507269d into swyddfa:develop Nov 18, 2023
13 of 14 checks passed
@alcarney alcarney deleted the workspace-config branch November 18, 2023 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch to workspace configuration
1 participant