diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 413cb91af2a..7dc25c1e6d7 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -272,7 +272,7 @@ config_data! { lens_references_adt_enable: bool = "false", /// Whether to show `References` lens for Enum Variants. /// Only applies when `#rust-analyzer.lens.enable#` is set. - lens_references_adt_variant_enable: bool = "false", + lens_references_enumVariant_enable: bool = "false", /// Whether to show `Method References` lens. Only applies when /// `#rust-analyzer.lens.enable#` is set. lens_references_method_enable: bool = "false", @@ -346,10 +346,10 @@ config_data! { /// their contents. semanticHighlighting_strings_enable: bool = "true", + /// Show full signature of the callable. Only shows parameters if disabled. + signatureInfo_detail: SignatureDetail = "\"full\"", /// Show documentation. signatureInfo_documentation_enable: bool = "true", - /// Show full signature of the callable. Only shows parameters if disabled. - signatureInfo_signature_enable: bool = "true", /// Workspace symbol search kind. workspace_symbol_search_kind: WorkspaceSymbolSearchKindDef = "\"only_types\"", @@ -1041,7 +1041,7 @@ impl Config { pub fn call_info(&self) -> CallInfoConfig { CallInfoConfig { - params_only: self.data.signatureInfo_signature_enable, + params_only: matches!(self.data.signatureInfo_detail, SignatureDetail::Parameters), docs: self.data.signatureInfo_documentation_enable, } } @@ -1055,7 +1055,7 @@ impl Config { refs_adt: self.data.lens_enable && self.data.lens_references_adt_enable, refs_trait: self.data.lens_enable && self.data.lens_references_trait_enable, enum_variant_refs: self.data.lens_enable - && self.data.lens_references_adt_variant_enable, + && self.data.lens_references_enumVariant_enable, } } @@ -1365,6 +1365,13 @@ enum WorkspaceSymbolSearchScopeDef { WorkspaceAndDependencies, } +#[derive(Deserialize, Debug, Clone)] +#[serde(rename_all = "snake_case")] +enum SignatureDetail { + Full, + Parameters, +} + #[derive(Deserialize, Debug, Clone)] #[serde(rename_all = "snake_case")] enum WorkspaceSymbolSearchKindDef { @@ -1637,6 +1644,14 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json "Add call parentheses", ], }, + "SignatureDetail" => set! { + "type": "string", + "enum": ["full", "parameters"], + "enumDescriptions": [ + "Show the entire signature.", + "Show only the parameters." + ], + }, _ => panic!("missing entry for {}: {}", ty, default), } diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc index c70bf206ffe..ab9f7db8847 100644 --- a/docs/user/generated_config.adoc +++ b/docs/user/generated_config.adoc @@ -413,7 +413,7 @@ Whether to show `Implementations` lens. Only applies when Whether to show `References` lens for Struct, Enum, and Union. Only applies when `#rust-analyzer.lens.enable#` is set. -- -[[rust-analyzer.lens.references.adt.variant.enable]]rust-analyzer.lens.references.adt.variant.enable (default: `false`):: +[[rust-analyzer.lens.references.enumVariant.enable]]rust-analyzer.lens.references.enumVariant.enable (default: `false`):: + -- Whether to show `References` lens for Enum Variants. @@ -539,16 +539,16 @@ In some editors (e.g. vscode) semantic tokens override other highlighting gramma By disabling semantic tokens for strings, other grammars can be used to highlight their contents. -- +[[rust-analyzer.signatureInfo.detail]]rust-analyzer.signatureInfo.detail (default: `"full"`):: ++ +-- +Show full signature of the callable. Only shows parameters if disabled. +-- [[rust-analyzer.signatureInfo.documentation.enable]]rust-analyzer.signatureInfo.documentation.enable (default: `true`):: + -- Show documentation. -- -[[rust-analyzer.signatureInfo.signature.enable]]rust-analyzer.signatureInfo.signature.enable (default: `true`):: -+ --- -Show full signature of the callable. Only shows parameters if disabled. --- [[rust-analyzer.workspace.symbol.search.kind]]rust-analyzer.workspace.symbol.search.kind (default: `"only_types"`):: + -- diff --git a/editors/code/package.json b/editors/code/package.json index c4e7036a3ce..df5d9b36090 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -873,7 +873,7 @@ "default": false, "type": "boolean" }, - "rust-analyzer.lens.references.adt.variant.enable": { + "rust-analyzer.lens.references.enumVariant.enable": { "markdownDescription": "Whether to show `References` lens for Enum Variants.\nOnly applies when `#rust-analyzer.lens.enable#` is set.", "default": false, "type": "boolean" @@ -1006,16 +1006,24 @@ "default": true, "type": "boolean" }, + "rust-analyzer.signatureInfo.detail": { + "markdownDescription": "Show full signature of the callable. Only shows parameters if disabled.", + "default": "full", + "type": "string", + "enum": [ + "full", + "parameters" + ], + "enumDescriptions": [ + "Show the entire signature.", + "Show only the parameters." + ] + }, "rust-analyzer.signatureInfo.documentation.enable": { "markdownDescription": "Show documentation.", "default": true, "type": "boolean" }, - "rust-analyzer.signatureInfo.signature.enable": { - "markdownDescription": "Show full signature of the callable. Only shows parameters if disabled.", - "default": true, - "type": "boolean" - }, "rust-analyzer.workspace.symbol.search.kind": { "markdownDescription": "Workspace symbol search kind.", "default": "only_types",