Auto merge of #12252 - Veykril:config, r=Veykril

internal: Make VSCode config more GUI edit friendly
This commit is contained in:
bors 2022-05-14 11:56:11 +00:00
commit 50ed1a507e
3 changed files with 106 additions and 121 deletions

View File

@ -109,7 +109,8 @@ struct ConfigData {
/// ///
/// Set to `"all"` to pass `--all-features` to cargo. /// Set to `"all"` to pass `--all-features` to cargo.
checkOnSave_features: Option<CargoFeatures> = "null", checkOnSave_features: Option<CargoFeatures> = "null",
/// Do not activate the `default` feature. /// Whether to pass `--no-default-features` to cargo. Defaults to
/// `#rust-analyzer.cargo.noDefaultFeatures#`.
checkOnSave_noDefaultFeatures: Option<bool> = "null", checkOnSave_noDefaultFeatures: Option<bool> = "null",
/// Override the command rust-analyzer uses to run build scripts and /// Override the command rust-analyzer uses to run build scripts and
/// build procedural macros. The command is required to output json /// build procedural macros. The command is required to output json
@ -134,7 +135,7 @@ struct ConfigData {
/// with `self` prefixed to them when inside a method. /// with `self` prefixed to them when inside a method.
completion_autoself_enable: bool = "true", completion_autoself_enable: bool = "true",
/// Whether to add parenthesis and argument snippets when completing function. /// Whether to add parenthesis and argument snippets when completing function.
completion_callable_snippets: Option<CallableCompletionDef> = "\"fill_arguments\"", completion_callable_snippets: CallableCompletionDef = "\"fill_arguments\"",
/// Whether to show postfix snippets like `dbg`, `if`, `not`, etc. /// Whether to show postfix snippets like `dbg`, `if`, `not`, etc.
completion_postfix_enable: bool = "true", completion_postfix_enable: bool = "true",
/// Enables completions of private items and fields that are defined in the current workspace even if they are not visible at the current position. /// 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 @@ pub fn completion(&self) -> CompletionConfig {
&& completion_item_edit_resolve(&self.caps), && completion_item_edit_resolve(&self.caps),
enable_self_on_the_fly: self.data.completion_autoself_enable, enable_self_on_the_fly: self.data.completion_autoself_enable,
enable_private_editable: self.data.completion_privateEditable_enable, enable_private_editable: self.data.completion_privateEditable_enable,
callable: self.data.completion_callable_snippets.map(|it| match it { callable: match self.data.completion_callable_snippets {
CallableCompletionDef::FillArguments => CallableSnippets::FillArguments, CallableCompletionDef::FillArguments => Some(CallableSnippets::FillArguments),
CallableCompletionDef::AddParentheses => CallableSnippets::AddParentheses, CallableCompletionDef::AddParentheses => Some(CallableSnippets::AddParentheses),
}), CallableCompletionDef::None => None,
},
insert_use: self.insert_use_config(), insert_use: self.insert_use_config(),
snippet_cap: SnippetCap::new(try_or_def!( snippet_cap: SnippetCap::new(try_or_def!(
self.caps self.caps
@ -1385,6 +1387,7 @@ enum ImportGranularityDef {
enum CallableCompletionDef { enum CallableCompletionDef {
FillArguments, FillArguments,
AddParentheses, AddParentheses,
None,
} }
#[derive(Deserialize, Debug, Clone)] #[derive(Deserialize, Debug, Clone)]
@ -1662,16 +1665,16 @@ macro_rules! set {
"type": "string", "type": "string",
"enum": ["workspace", "workspace_and_dependencies"], "enum": ["workspace", "workspace_and_dependencies"],
"enumDescriptions": [ "enumDescriptions": [
"Search in current workspace only", "Search in current workspace only.",
"Search in current workspace and dependencies" "Search in current workspace and dependencies."
], ],
}, },
"WorkspaceSymbolSearchKindDef" => set! { "WorkspaceSymbolSearchKindDef" => set! {
"type": "string", "type": "string",
"enum": ["only_types", "all_symbols"], "enum": ["only_types", "all_symbols"],
"enumDescriptions": [ "enumDescriptions": [
"Search for types only", "Search for types only.",
"Search for all symbols kinds" "Search for all symbols kinds."
], ],
}, },
"ParallelCachePrimingNumThreads" => set! { "ParallelCachePrimingNumThreads" => set! {
@ -1680,47 +1683,46 @@ macro_rules! set {
"maximum": 255 "maximum": 255
}, },
"LifetimeElisionDef" => set! { "LifetimeElisionDef" => set! {
"anyOf": [ "type": "string",
{ "enum": [
"type": "string", "always",
"enum": [ "never",
"always", "skip_trivial"
"never",
"skip_trivial"
],
"enumDescriptions": [
"Always show lifetime elision hints.",
"Never show lifetime elision hints.",
"Only show lifetime elision hints if a return type is involved."
]
},
{ "type": "boolean" }
], ],
"enumDescriptions": [
"Always show lifetime elision hints.",
"Never show lifetime elision hints.",
"Only show lifetime elision hints if a return type is involved."
]
}, },
"ReborrowHintsDef" => set! { "ReborrowHintsDef" => set! {
"type": "string",
"enum": [
"always",
"never",
"mutable"
],
"enumDescriptions": [
"Always show reborrow hints.",
"Never show reborrow hints.",
"Only show mutable reborrow hints."
]
},
"CargoFeatures" => set! {
"anyOf": [ "anyOf": [
{ {
"type": "string", "type": "string",
"enum": [ "enum": [
"always", "all"
"never",
"mutable"
], ],
"enumDescriptions": [ "enumDescriptions": [
"Always show reborrow hints.", "Pass `--all-features` to cargo",
"Never show reborrow hints.",
"Only show mutable reborrow hints."
] ]
}, },
{ "type": "boolean" } {
], "type": "array",
}, "items": { "type": "string" }
"CargoFeatures" => set! { }
"type": ["string", "array"],
"items": { "type": "string" },
"enum": ["all"],
"enumDescriptions": [
"Pass `--all-features` to cargo",
], ],
}, },
"Option<CargoFeatures>" => set! { "Option<CargoFeatures>" => set! {
@ -1741,21 +1743,18 @@ macro_rules! set {
{ "type": "null" } { "type": "null" }
], ],
}, },
"Option<CallableCompletionDef>" => set! { "CallableCompletionDef" => set! {
"anyOf": [ "type": "string",
{ "enum": [
"type": "string", "fill_arguments",
"enum": [ "add_parentheses",
"fill_arguments", "none",
"add_parentheses"
],
"enumDescriptions": [
"Add call parentheses and pre-fill arguments",
"Add call parentheses"
]
},
{ "type": "null" }
], ],
"enumDescriptions": [
"Add call parentheses and pre-fill arguments.",
"Add call parentheses.",
"Do no snippet completions for callables."
]
}, },
"SignatureDetail" => set! { "SignatureDetail" => set! {
"type": "string", "type": "string",

View File

@ -104,7 +104,8 @@ Set to `"all"` to pass `--all-features` to cargo.
[[rust-analyzer.checkOnSave.noDefaultFeatures]]rust-analyzer.checkOnSave.noDefaultFeatures (default: `null`):: [[rust-analyzer.checkOnSave.noDefaultFeatures]]rust-analyzer.checkOnSave.noDefaultFeatures (default: `null`)::
+ +
-- --
Do not activate the `default` feature. Whether to pass `--no-default-features` to cargo. Defaults to
`#rust-analyzer.cargo.noDefaultFeatures#`.
-- --
[[rust-analyzer.checkOnSave.overrideCommand]]rust-analyzer.checkOnSave.overrideCommand (default: `null`):: [[rust-analyzer.checkOnSave.overrideCommand]]rust-analyzer.checkOnSave.overrideCommand (default: `null`)::
+ +

View File

@ -423,18 +423,22 @@
"rust-analyzer.cargo.features": { "rust-analyzer.cargo.features": {
"markdownDescription": "List of features to activate.\n\nSet this to `\"all\"` to pass `--all-features` to cargo.", "markdownDescription": "List of features to activate.\n\nSet this to `\"all\"` to pass `--all-features` to cargo.",
"default": [], "default": [],
"type": [ "anyOf": [
"string", {
"array" "type": "string",
], "enum": [
"items": { "all"
"type": "string" ],
}, "enumDescriptions": [
"enum": [ "Pass `--all-features` to cargo"
"all" ]
], },
"enumDescriptions": [ {
"Pass `--all-features` to cargo" "type": "array",
"items": {
"type": "string"
}
}
] ]
}, },
"rust-analyzer.cargo.noDefaultFeatures": { "rust-analyzer.cargo.noDefaultFeatures": {
@ -513,7 +517,7 @@
] ]
}, },
"rust-analyzer.checkOnSave.noDefaultFeatures": { "rust-analyzer.checkOnSave.noDefaultFeatures": {
"markdownDescription": "Do not activate the `default` feature.", "markdownDescription": "Whether to pass `--no-default-features` to cargo. Defaults to\n`#rust-analyzer.cargo.noDefaultFeatures#`.",
"default": null, "default": null,
"type": [ "type": [
"null", "null",
@ -552,21 +556,16 @@
"rust-analyzer.completion.callable.snippets": { "rust-analyzer.completion.callable.snippets": {
"markdownDescription": "Whether to add parenthesis and argument snippets when completing function.", "markdownDescription": "Whether to add parenthesis and argument snippets when completing function.",
"default": "fill_arguments", "default": "fill_arguments",
"anyOf": [ "type": "string",
{ "enum": [
"type": "string", "fill_arguments",
"enum": [ "add_parentheses",
"fill_arguments", "none"
"add_parentheses" ],
], "enumDescriptions": [
"enumDescriptions": [ "Add call parentheses and pre-fill arguments.",
"Add call parentheses and pre-fill arguments", "Add call parentheses.",
"Add call parentheses" "Do no snippet completions for callables."
]
},
{
"type": "null"
}
] ]
}, },
"rust-analyzer.completion.postfix.enable": { "rust-analyzer.completion.postfix.enable": {
@ -797,23 +796,16 @@
"rust-analyzer.inlayHints.lifetimeElisionHints.enable": { "rust-analyzer.inlayHints.lifetimeElisionHints.enable": {
"markdownDescription": "Whether to show inlay type hints for elided lifetimes in function signatures.", "markdownDescription": "Whether to show inlay type hints for elided lifetimes in function signatures.",
"default": "never", "default": "never",
"anyOf": [ "type": "string",
{ "enum": [
"type": "string", "always",
"enum": [ "never",
"always", "skip_trivial"
"never", ],
"skip_trivial" "enumDescriptions": [
], "Always show lifetime elision hints.",
"enumDescriptions": [ "Never show lifetime elision hints.",
"Always show lifetime elision hints.", "Only show lifetime elision hints if a return type is involved."
"Never show lifetime elision hints.",
"Only show lifetime elision hints if a return type is involved."
]
},
{
"type": "boolean"
}
] ]
}, },
"rust-analyzer.inlayHints.lifetimeElisionHints.useParameterNames": { "rust-analyzer.inlayHints.lifetimeElisionHints.useParameterNames": {
@ -838,23 +830,16 @@
"rust-analyzer.inlayHints.reborrowHints.enable": { "rust-analyzer.inlayHints.reborrowHints.enable": {
"markdownDescription": "Whether to show inlay type hints for compiler inserted reborrows.", "markdownDescription": "Whether to show inlay type hints for compiler inserted reborrows.",
"default": "never", "default": "never",
"anyOf": [ "type": "string",
{ "enum": [
"type": "string", "always",
"enum": [ "never",
"always", "mutable"
"never", ],
"mutable" "enumDescriptions": [
], "Always show reborrow hints.",
"enumDescriptions": [ "Never show reborrow hints.",
"Always show reborrow hints.", "Only show mutable reborrow hints."
"Never show reborrow hints.",
"Only show mutable reborrow hints."
]
},
{
"type": "boolean"
}
] ]
}, },
"rust-analyzer.inlayHints.renderColons": { "rust-analyzer.inlayHints.renderColons": {
@ -1065,8 +1050,8 @@
"all_symbols" "all_symbols"
], ],
"enumDescriptions": [ "enumDescriptions": [
"Search for types only", "Search for types only.",
"Search for all symbols kinds" "Search for all symbols kinds."
] ]
}, },
"rust-analyzer.workspace.symbol.search.limit": { "rust-analyzer.workspace.symbol.search.limit": {
@ -1084,8 +1069,8 @@
"workspace_and_dependencies" "workspace_and_dependencies"
], ],
"enumDescriptions": [ "enumDescriptions": [
"Search in current workspace only", "Search in current workspace only.",
"Search in current workspace and dependencies" "Search in current workspace and dependencies."
] ]
}, },
"$generated-end": {} "$generated-end": {}