Skip to content

Commit 4300d01

Browse files
committed
Adjust signature info and enum variant lenses
1 parent 73b3c02 commit 4300d01

File tree

3 files changed

+39
-16
lines changed

3 files changed

+39
-16
lines changed

crates/rust-analyzer/src/config.rs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ config_data! {
272272
lens_references_adt_enable: bool = "false",
273273
/// Whether to show `References` lens for Enum Variants.
274274
/// Only applies when `#rust-analyzer.lens.enable#` is set.
275-
lens_references_adt_variant_enable: bool = "false",
275+
lens_references_enumVariant_enable: bool = "false",
276276
/// Whether to show `Method References` lens. Only applies when
277277
/// `#rust-analyzer.lens.enable#` is set.
278278
lens_references_method_enable: bool = "false",
@@ -346,10 +346,10 @@ config_data! {
346346
/// their contents.
347347
semanticHighlighting_strings_enable: bool = "true",
348348

349+
/// Show full signature of the callable. Only shows parameters if disabled.
350+
signatureInfo_detail: SignatureDetail = "\"full\"",
349351
/// Show documentation.
350352
signatureInfo_documentation_enable: bool = "true",
351-
/// Show full signature of the callable. Only shows parameters if disabled.
352-
signatureInfo_signature_enable: bool = "true",
353353

354354
/// Workspace symbol search kind.
355355
workspace_symbol_search_kind: WorkspaceSymbolSearchKindDef = "\"only_types\"",
@@ -1041,7 +1041,7 @@ impl Config {
10411041

10421042
pub fn call_info(&self) -> CallInfoConfig {
10431043
CallInfoConfig {
1044-
params_only: self.data.signatureInfo_signature_enable,
1044+
params_only: matches!(self.data.signatureInfo_detail, SignatureDetail::Parameters),
10451045
docs: self.data.signatureInfo_documentation_enable,
10461046
}
10471047
}
@@ -1055,7 +1055,7 @@ impl Config {
10551055
refs_adt: self.data.lens_enable && self.data.lens_references_adt_enable,
10561056
refs_trait: self.data.lens_enable && self.data.lens_references_trait_enable,
10571057
enum_variant_refs: self.data.lens_enable
1058-
&& self.data.lens_references_adt_variant_enable,
1058+
&& self.data.lens_references_enumVariant_enable,
10591059
}
10601060
}
10611061

@@ -1365,6 +1365,13 @@ enum WorkspaceSymbolSearchScopeDef {
13651365
WorkspaceAndDependencies,
13661366
}
13671367

1368+
#[derive(Deserialize, Debug, Clone)]
1369+
#[serde(rename_all = "snake_case")]
1370+
enum SignatureDetail {
1371+
Full,
1372+
Parameters,
1373+
}
1374+
13681375
#[derive(Deserialize, Debug, Clone)]
13691376
#[serde(rename_all = "snake_case")]
13701377
enum WorkspaceSymbolSearchKindDef {
@@ -1637,6 +1644,14 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
16371644
"Add call parentheses",
16381645
],
16391646
},
1647+
"SignatureDetail" => set! {
1648+
"type": "string",
1649+
"enum": ["full", "parameters"],
1650+
"enumDescriptions": [
1651+
"Show the entire signature.",
1652+
"Show only the parameters."
1653+
],
1654+
},
16401655
_ => panic!("missing entry for {}: {}", ty, default),
16411656
}
16421657

docs/user/generated_config.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ Whether to show `Implementations` lens. Only applies when
413413
Whether to show `References` lens for Struct, Enum, and Union.
414414
Only applies when `#rust-analyzer.lens.enable#` is set.
415415
--
416-
[[rust-analyzer.lens.references.adt.variant.enable]]rust-analyzer.lens.references.adt.variant.enable (default: `false`)::
416+
[[rust-analyzer.lens.references.enumVariant.enable]]rust-analyzer.lens.references.enumVariant.enable (default: `false`)::
417417
+
418418
--
419419
Whether to show `References` lens for Enum Variants.
@@ -539,15 +539,15 @@ In some editors (e.g. vscode) semantic tokens override other highlighting gramma
539539
By disabling semantic tokens for strings, other grammars can be used to highlight
540540
their contents.
541541
--
542-
[[rust-analyzer.signatureInfo.documentation.enable]]rust-analyzer.signatureInfo.documentation.enable (default: `true`)::
542+
[[rust-analyzer.signatureInfo.detail]]rust-analyzer.signatureInfo.detail (default: `"full"`)::
543543
+
544544
--
545-
Show documentation.
545+
Show full signature of the callable. Only shows parameters if disabled.
546546
--
547-
[[rust-analyzer.signatureInfo.signature.enable]]rust-analyzer.signatureInfo.signature.enable (default: `true`)::
547+
[[rust-analyzer.signatureInfo.documentation.enable]]rust-analyzer.signatureInfo.documentation.enable (default: `true`)::
548548
+
549549
--
550-
Show full signature of the callable. Only shows parameters if disabled.
550+
Show documentation.
551551
--
552552
[[rust-analyzer.workspace.symbol.search.kind]]rust-analyzer.workspace.symbol.search.kind (default: `"only_types"`)::
553553
+

editors/code/package.json

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@
873873
"default": false,
874874
"type": "boolean"
875875
},
876-
"rust-analyzer.lens.references.adt.variant.enable": {
876+
"rust-analyzer.lens.references.enumVariant.enable": {
877877
"markdownDescription": "Whether to show `References` lens for Enum Variants.\nOnly applies when `#rust-analyzer.lens.enable#` is set.",
878878
"default": false,
879879
"type": "boolean"
@@ -1006,16 +1006,24 @@
10061006
"default": true,
10071007
"type": "boolean"
10081008
},
1009+
"rust-analyzer.signatureInfo.detail": {
1010+
"markdownDescription": "Show full signature of the callable. Only shows parameters if disabled.",
1011+
"default": "full",
1012+
"type": "string",
1013+
"enum": [
1014+
"full",
1015+
"parameters"
1016+
],
1017+
"enumDescriptions": [
1018+
"Show the entire signature.",
1019+
"Show only the parameters."
1020+
]
1021+
},
10091022
"rust-analyzer.signatureInfo.documentation.enable": {
10101023
"markdownDescription": "Show documentation.",
10111024
"default": true,
10121025
"type": "boolean"
10131026
},
1014-
"rust-analyzer.signatureInfo.signature.enable": {
1015-
"markdownDescription": "Show full signature of the callable. Only shows parameters if disabled.",
1016-
"default": true,
1017-
"type": "boolean"
1018-
},
10191027
"rust-analyzer.workspace.symbol.search.kind": {
10201028
"markdownDescription": "Workspace symbol search kind.",
10211029
"default": "only_types",

0 commit comments

Comments
 (0)