Adjust signature info and enum variant lenses

This commit is contained in:
Lukas Wirth 2022-04-27 17:51:44 +02:00
parent b84f3cc98f
commit 3d17261972
3 changed files with 40 additions and 17 deletions

View File

@ -272,7 +272,7 @@ config_data! {
lens_references_adt_enable: bool = "false", lens_references_adt_enable: bool = "false",
/// Whether to show `References` lens for Enum Variants. /// Whether to show `References` lens for Enum Variants.
/// Only applies when `#rust-analyzer.lens.enable#` is set. /// 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 /// Whether to show `Method References` lens. Only applies when
/// `#rust-analyzer.lens.enable#` is set. /// `#rust-analyzer.lens.enable#` is set.
lens_references_method_enable: bool = "false", lens_references_method_enable: bool = "false",
@ -346,10 +346,10 @@ config_data! {
/// their contents. /// their contents.
semanticHighlighting_strings_enable: bool = "true", semanticHighlighting_strings_enable: bool = "true",
/// Show full signature of the callable. Only shows parameters if disabled.
signatureInfo_detail: SignatureDetail = "\"full\"",
/// Show documentation. /// Show documentation.
signatureInfo_documentation_enable: bool = "true", 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.
workspace_symbol_search_kind: WorkspaceSymbolSearchKindDef = "\"only_types\"", workspace_symbol_search_kind: WorkspaceSymbolSearchKindDef = "\"only_types\"",
@ -1041,7 +1041,7 @@ impl Config {
pub fn call_info(&self) -> CallInfoConfig { pub fn call_info(&self) -> CallInfoConfig {
CallInfoConfig { CallInfoConfig {
params_only: self.data.signatureInfo_signature_enable, params_only: matches!(self.data.signatureInfo_detail, SignatureDetail::Parameters),
docs: self.data.signatureInfo_documentation_enable, 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_adt: self.data.lens_enable && self.data.lens_references_adt_enable,
refs_trait: self.data.lens_enable && self.data.lens_references_trait_enable, refs_trait: self.data.lens_enable && self.data.lens_references_trait_enable,
enum_variant_refs: self.data.lens_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, WorkspaceAndDependencies,
} }
#[derive(Deserialize, Debug, Clone)]
#[serde(rename_all = "snake_case")]
enum SignatureDetail {
Full,
Parameters,
}
#[derive(Deserialize, Debug, Clone)] #[derive(Deserialize, Debug, Clone)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
enum WorkspaceSymbolSearchKindDef { enum WorkspaceSymbolSearchKindDef {
@ -1637,6 +1644,14 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
"Add call parentheses", "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), _ => panic!("missing entry for {}: {}", ty, default),
} }

View File

@ -413,7 +413,7 @@ Whether to show `Implementations` lens. Only applies when
Whether to show `References` lens for Struct, Enum, and Union. Whether to show `References` lens for Struct, Enum, and Union.
Only applies when `#rust-analyzer.lens.enable#` is set. 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. 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 By disabling semantic tokens for strings, other grammars can be used to highlight
their contents. 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`):: [[rust-analyzer.signatureInfo.documentation.enable]]rust-analyzer.signatureInfo.documentation.enable (default: `true`)::
+ +
-- --
Show documentation. 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"`):: [[rust-analyzer.workspace.symbol.search.kind]]rust-analyzer.workspace.symbol.search.kind (default: `"only_types"`)::
+ +
-- --

View File

@ -873,7 +873,7 @@
"default": false, "default": false,
"type": "boolean" "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.", "markdownDescription": "Whether to show `References` lens for Enum Variants.\nOnly applies when `#rust-analyzer.lens.enable#` is set.",
"default": false, "default": false,
"type": "boolean" "type": "boolean"
@ -1006,16 +1006,24 @@
"default": true, "default": true,
"type": "boolean" "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": { "rust-analyzer.signatureInfo.documentation.enable": {
"markdownDescription": "Show documentation.", "markdownDescription": "Show documentation.",
"default": true, "default": true,
"type": "boolean" "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": { "rust-analyzer.workspace.symbol.search.kind": {
"markdownDescription": "Workspace symbol search kind.", "markdownDescription": "Workspace symbol search kind.",
"default": "only_types", "default": "only_types",