Skip to content

Commit 50ed1a5

Browse files
committed
Auto merge of rust-lang#12252 - Veykril:config, r=Veykril
internal: Make VSCode config more GUI edit friendly
2 parents 06448c5 + 622defb commit 50ed1a5

File tree

3 files changed

+106
-121
lines changed

3 files changed

+106
-121
lines changed

crates/rust-analyzer/src/config.rs

+53-54
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ config_data! {
109109
///
110110
/// Set to `"all"` to pass `--all-features` to cargo.
111111
checkOnSave_features: Option<CargoFeatures> = "null",
112-
/// Do not activate the `default` feature.
112+
/// Whether to pass `--no-default-features` to cargo. Defaults to
113+
/// `#rust-analyzer.cargo.noDefaultFeatures#`.
113114
checkOnSave_noDefaultFeatures: Option<bool> = "null",
114115
/// Override the command rust-analyzer uses to run build scripts and
115116
/// build procedural macros. The command is required to output json
@@ -134,7 +135,7 @@ config_data! {
134135
/// with `self` prefixed to them when inside a method.
135136
completion_autoself_enable: bool = "true",
136137
/// Whether to add parenthesis and argument snippets when completing function.
137-
completion_callable_snippets: Option<CallableCompletionDef> = "\"fill_arguments\"",
138+
completion_callable_snippets: CallableCompletionDef = "\"fill_arguments\"",
138139
/// Whether to show postfix snippets like `dbg`, `if`, `not`, etc.
139140
completion_postfix_enable: bool = "true",
140141
/// Enables completions of private items and fields that are defined in the current workspace even if they are not visible at the current position.
@@ -1030,10 +1031,11 @@ impl Config {
10301031
&& completion_item_edit_resolve(&self.caps),
10311032
enable_self_on_the_fly: self.data.completion_autoself_enable,
10321033
enable_private_editable: self.data.completion_privateEditable_enable,
1033-
callable: self.data.completion_callable_snippets.map(|it| match it {
1034-
CallableCompletionDef::FillArguments => CallableSnippets::FillArguments,
1035-
CallableCompletionDef::AddParentheses => CallableSnippets::AddParentheses,
1036-
}),
1034+
callable: match self.data.completion_callable_snippets {
1035+
CallableCompletionDef::FillArguments => Some(CallableSnippets::FillArguments),
1036+
CallableCompletionDef::AddParentheses => Some(CallableSnippets::AddParentheses),
1037+
CallableCompletionDef::None => None,
1038+
},
10371039
insert_use: self.insert_use_config(),
10381040
snippet_cap: SnippetCap::new(try_or_def!(
10391041
self.caps
@@ -1385,6 +1387,7 @@ enum ImportGranularityDef {
13851387
enum CallableCompletionDef {
13861388
FillArguments,
13871389
AddParentheses,
1390+
None,
13881391
}
13891392

13901393
#[derive(Deserialize, Debug, Clone)]
@@ -1662,16 +1665,16 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
16621665
"type": "string",
16631666
"enum": ["workspace", "workspace_and_dependencies"],
16641667
"enumDescriptions": [
1665-
"Search in current workspace only",
1666-
"Search in current workspace and dependencies"
1668+
"Search in current workspace only.",
1669+
"Search in current workspace and dependencies."
16671670
],
16681671
},
16691672
"WorkspaceSymbolSearchKindDef" => set! {
16701673
"type": "string",
16711674
"enum": ["only_types", "all_symbols"],
16721675
"enumDescriptions": [
1673-
"Search for types only",
1674-
"Search for all symbols kinds"
1676+
"Search for types only.",
1677+
"Search for all symbols kinds."
16751678
],
16761679
},
16771680
"ParallelCachePrimingNumThreads" => set! {
@@ -1680,47 +1683,46 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
16801683
"maximum": 255
16811684
},
16821685
"LifetimeElisionDef" => set! {
1683-
"anyOf": [
1684-
{
1685-
"type": "string",
1686-
"enum": [
1687-
"always",
1688-
"never",
1689-
"skip_trivial"
1690-
],
1691-
"enumDescriptions": [
1692-
"Always show lifetime elision hints.",
1693-
"Never show lifetime elision hints.",
1694-
"Only show lifetime elision hints if a return type is involved."
1695-
]
1696-
},
1697-
{ "type": "boolean" }
1686+
"type": "string",
1687+
"enum": [
1688+
"always",
1689+
"never",
1690+
"skip_trivial"
16981691
],
1692+
"enumDescriptions": [
1693+
"Always show lifetime elision hints.",
1694+
"Never show lifetime elision hints.",
1695+
"Only show lifetime elision hints if a return type is involved."
1696+
]
16991697
},
17001698
"ReborrowHintsDef" => set! {
1699+
"type": "string",
1700+
"enum": [
1701+
"always",
1702+
"never",
1703+
"mutable"
1704+
],
1705+
"enumDescriptions": [
1706+
"Always show reborrow hints.",
1707+
"Never show reborrow hints.",
1708+
"Only show mutable reborrow hints."
1709+
]
1710+
},
1711+
"CargoFeatures" => set! {
17011712
"anyOf": [
17021713
{
17031714
"type": "string",
17041715
"enum": [
1705-
"always",
1706-
"never",
1707-
"mutable"
1716+
"all"
17081717
],
17091718
"enumDescriptions": [
1710-
"Always show reborrow hints.",
1711-
"Never show reborrow hints.",
1712-
"Only show mutable reborrow hints."
1719+
"Pass `--all-features` to cargo",
17131720
]
17141721
},
1715-
{ "type": "boolean" }
1716-
],
1717-
},
1718-
"CargoFeatures" => set! {
1719-
"type": ["string", "array"],
1720-
"items": { "type": "string" },
1721-
"enum": ["all"],
1722-
"enumDescriptions": [
1723-
"Pass `--all-features` to cargo",
1722+
{
1723+
"type": "array",
1724+
"items": { "type": "string" }
1725+
}
17241726
],
17251727
},
17261728
"Option<CargoFeatures>" => set! {
@@ -1741,21 +1743,18 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
17411743
{ "type": "null" }
17421744
],
17431745
},
1744-
"Option<CallableCompletionDef>" => set! {
1745-
"anyOf": [
1746-
{
1747-
"type": "string",
1748-
"enum": [
1749-
"fill_arguments",
1750-
"add_parentheses"
1751-
],
1752-
"enumDescriptions": [
1753-
"Add call parentheses and pre-fill arguments",
1754-
"Add call parentheses"
1755-
]
1756-
},
1757-
{ "type": "null" }
1746+
"CallableCompletionDef" => set! {
1747+
"type": "string",
1748+
"enum": [
1749+
"fill_arguments",
1750+
"add_parentheses",
1751+
"none",
17581752
],
1753+
"enumDescriptions": [
1754+
"Add call parentheses and pre-fill arguments.",
1755+
"Add call parentheses.",
1756+
"Do no snippet completions for callables."
1757+
]
17591758
},
17601759
"SignatureDetail" => set! {
17611760
"type": "string",

docs/user/generated_config.adoc

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ Set to `"all"` to pass `--all-features` to cargo.
104104
[[rust-analyzer.checkOnSave.noDefaultFeatures]]rust-analyzer.checkOnSave.noDefaultFeatures (default: `null`)::
105105
+
106106
--
107-
Do not activate the `default` feature.
107+
Whether to pass `--no-default-features` to cargo. Defaults to
108+
`#rust-analyzer.cargo.noDefaultFeatures#`.
108109
--
109110
[[rust-analyzer.checkOnSave.overrideCommand]]rust-analyzer.checkOnSave.overrideCommand (default: `null`)::
110111
+

editors/code/package.json

+51-66
Original file line numberDiff line numberDiff line change
@@ -423,18 +423,22 @@
423423
"rust-analyzer.cargo.features": {
424424
"markdownDescription": "List of features to activate.\n\nSet this to `\"all\"` to pass `--all-features` to cargo.",
425425
"default": [],
426-
"type": [
427-
"string",
428-
"array"
429-
],
430-
"items": {
431-
"type": "string"
432-
},
433-
"enum": [
434-
"all"
435-
],
436-
"enumDescriptions": [
437-
"Pass `--all-features` to cargo"
426+
"anyOf": [
427+
{
428+
"type": "string",
429+
"enum": [
430+
"all"
431+
],
432+
"enumDescriptions": [
433+
"Pass `--all-features` to cargo"
434+
]
435+
},
436+
{
437+
"type": "array",
438+
"items": {
439+
"type": "string"
440+
}
441+
}
438442
]
439443
},
440444
"rust-analyzer.cargo.noDefaultFeatures": {
@@ -513,7 +517,7 @@
513517
]
514518
},
515519
"rust-analyzer.checkOnSave.noDefaultFeatures": {
516-
"markdownDescription": "Do not activate the `default` feature.",
520+
"markdownDescription": "Whether to pass `--no-default-features` to cargo. Defaults to\n`#rust-analyzer.cargo.noDefaultFeatures#`.",
517521
"default": null,
518522
"type": [
519523
"null",
@@ -552,21 +556,16 @@
552556
"rust-analyzer.completion.callable.snippets": {
553557
"markdownDescription": "Whether to add parenthesis and argument snippets when completing function.",
554558
"default": "fill_arguments",
555-
"anyOf": [
556-
{
557-
"type": "string",
558-
"enum": [
559-
"fill_arguments",
560-
"add_parentheses"
561-
],
562-
"enumDescriptions": [
563-
"Add call parentheses and pre-fill arguments",
564-
"Add call parentheses"
565-
]
566-
},
567-
{
568-
"type": "null"
569-
}
559+
"type": "string",
560+
"enum": [
561+
"fill_arguments",
562+
"add_parentheses",
563+
"none"
564+
],
565+
"enumDescriptions": [
566+
"Add call parentheses and pre-fill arguments.",
567+
"Add call parentheses.",
568+
"Do no snippet completions for callables."
570569
]
571570
},
572571
"rust-analyzer.completion.postfix.enable": {
@@ -797,23 +796,16 @@
797796
"rust-analyzer.inlayHints.lifetimeElisionHints.enable": {
798797
"markdownDescription": "Whether to show inlay type hints for elided lifetimes in function signatures.",
799798
"default": "never",
800-
"anyOf": [
801-
{
802-
"type": "string",
803-
"enum": [
804-
"always",
805-
"never",
806-
"skip_trivial"
807-
],
808-
"enumDescriptions": [
809-
"Always show lifetime elision hints.",
810-
"Never show lifetime elision hints.",
811-
"Only show lifetime elision hints if a return type is involved."
812-
]
813-
},
814-
{
815-
"type": "boolean"
816-
}
799+
"type": "string",
800+
"enum": [
801+
"always",
802+
"never",
803+
"skip_trivial"
804+
],
805+
"enumDescriptions": [
806+
"Always show lifetime elision hints.",
807+
"Never show lifetime elision hints.",
808+
"Only show lifetime elision hints if a return type is involved."
817809
]
818810
},
819811
"rust-analyzer.inlayHints.lifetimeElisionHints.useParameterNames": {
@@ -838,23 +830,16 @@
838830
"rust-analyzer.inlayHints.reborrowHints.enable": {
839831
"markdownDescription": "Whether to show inlay type hints for compiler inserted reborrows.",
840832
"default": "never",
841-
"anyOf": [
842-
{
843-
"type": "string",
844-
"enum": [
845-
"always",
846-
"never",
847-
"mutable"
848-
],
849-
"enumDescriptions": [
850-
"Always show reborrow hints.",
851-
"Never show reborrow hints.",
852-
"Only show mutable reborrow hints."
853-
]
854-
},
855-
{
856-
"type": "boolean"
857-
}
833+
"type": "string",
834+
"enum": [
835+
"always",
836+
"never",
837+
"mutable"
838+
],
839+
"enumDescriptions": [
840+
"Always show reborrow hints.",
841+
"Never show reborrow hints.",
842+
"Only show mutable reborrow hints."
858843
]
859844
},
860845
"rust-analyzer.inlayHints.renderColons": {
@@ -1065,8 +1050,8 @@
10651050
"all_symbols"
10661051
],
10671052
"enumDescriptions": [
1068-
"Search for types only",
1069-
"Search for all symbols kinds"
1053+
"Search for types only.",
1054+
"Search for all symbols kinds."
10701055
]
10711056
},
10721057
"rust-analyzer.workspace.symbol.search.limit": {
@@ -1084,8 +1069,8 @@
10841069
"workspace_and_dependencies"
10851070
],
10861071
"enumDescriptions": [
1087-
"Search in current workspace only",
1088-
"Search in current workspace and dependencies"
1072+
"Search in current workspace only.",
1073+
"Search in current workspace and dependencies."
10891074
]
10901075
},
10911076
"$generated-end": {}

0 commit comments

Comments
 (0)