From efcd7f7d10a1e236010d01acdb37867b7ff9e333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20J=C3=B8rgen=20Br=C3=B8nner?= Date: Mon, 10 Nov 2025 22:08:40 +0100 Subject: [PATCH] Slightly improve completion in settings.json (for lsp..) (#42263) Document "any-typed" (`serde_json::Value`) "lsp" keys to include them in json-language-server completions. The vscode-json-languageserver seems to skip generically typed keys when offering completion. For this schema ``` "LspSettings": { "type": "object", "properties": { ... "initialization_options": true, ... } } ``` "initialization_options" is not offered in the completion. The effect is easy to verify by triggering completion inside: ``` "lsp": { "basedpyright": { COMPLETE HERE ``` image By adding a documentation string the keys are offered even if they are generically typed: image --- Note: I did some cursory research of whether it's possible to make vscode-json-languageserver change behavior without success. IMO, not offering completions here is a bug (or at minimal should be configurable) --- Release Notes: - N/A --------- Co-authored-by: Kirill Bulatov --- crates/settings/src/settings_content/project.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/settings/src/settings_content/project.rs b/crates/settings/src/settings_content/project.rs index 56c3ff1c78ead6b113799c1c11552e0732b62345..e7a3798ebfa827cd287255f464f9e35bddd619f4 100644 --- a/crates/settings/src/settings_content/project.rs +++ b/crates/settings/src/settings_content/project.rs @@ -26,6 +26,7 @@ pub struct ProjectSettingsContent { /// The following settings can be overridden for specific language servers: /// - initialization_options /// + /// /// To override settings for a language, add an entry for that language server's /// name to the lsp value. /// Default: null @@ -108,7 +109,19 @@ pub struct WorktreeSettingsContent { #[serde(rename_all = "snake_case")] pub struct LspSettings { pub binary: Option, + /// Options passed to the language server at startup. + /// + /// Ref: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#initialize + /// + /// Consult the documentation for the specific language server to see what settings + /// are supported. pub initialization_options: Option, + /// Language server settings. + /// + /// Ref: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_configuration + /// + /// Consult the documentation for the specific LSP to see what settings + /// are supported. pub settings: Option, /// If the server supports sending tasks over LSP extensions, /// this setting can be used to enable or disable them in Zed.