diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2023-09-02 16:36:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-02 16:36:04 +0100 |
commit | 12f6ad32c2108efb1492df6192a1f8cdd5eafa76 (patch) | |
tree | 8afd5f0a4890f62eba658850e294663540e949c4 /cli/lsp/config.rs | |
parent | 83426be6eead06c680ae527468aeaf8723543ff2 (diff) |
fix(lsp): properly handle disabled configuration requests (#20358)
Fixes #19802.
Properly respect when clients do not have the `workspace/configuration`
capability, a.k.a. when an editor cannot provide scoped settings on
request from the LSP.
- Fix one spot where we weren't checking for the capability before
sending this request.
- For `enablePaths`, fall back to the settings passed in the
initialization options in more cases.
- Respect the `workspace/configuration` capability in the test harness
client.
See:
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_configuration.
Diffstat (limited to 'cli/lsp/config.rs')
-rw-r--r-- | cli/lsp/config.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs index b70af6519..2d77abaee 100644 --- a/cli/lsp/config.rs +++ b/cli/lsp/config.rs @@ -718,13 +718,12 @@ impl Config { if let Some(workspace_folders) = self.workspace_folders.clone() { let mut touched = false; for (workspace, _) in workspace_folders { - if let Some(settings) = self.settings.specifiers.get(&workspace) { - if self.update_enabled_paths_entry( - workspace, - settings.enable_paths.clone(), - ) { - touched = true; - } + let enabled_paths = match self.settings.specifiers.get(&workspace) { + Some(settings) => settings.enable_paths.clone(), + None => self.settings.workspace.enable_paths.clone(), + }; + if self.update_enabled_paths_entry(workspace, enabled_paths) { + touched = true; } } touched |