fix: Fix vscode config descriptions not recognizing all valid values

This commit is contained in:
Lukas Wirth 2022-05-12 18:15:48 +02:00
parent 252ffbf77a
commit d57beac7e6
2 changed files with 126 additions and 72 deletions

View file

@ -1683,21 +1683,39 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
"maximum": 255 "maximum": 255
}, },
"LifetimeElisionDef" => set! { "LifetimeElisionDef" => set! {
"type": ["string", "boolean"], "anyOf": [
"enum": ["always", "never", "skip_trivial"], {
"enumDescriptions": [ "type": "string",
"Always show lifetime elision hints.", "enum": [
"Never show lifetime elision hints.", "always",
"Only show lifetime elision hints if a return type is involved." "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" }
], ],
}, },
"ReborrowHintsDef" => set! { "ReborrowHintsDef" => set! {
"type": ["string", "boolean"], "anyOf": [
"enum": ["always", "never", "mutable"], {
"enumDescriptions": [ "type": "string",
"Always show reborrow hints.", "enum": [
"Never show reborrow hints.", "always",
"Only show mutable reborrow hints." "never",
"mutable"
],
"enumDescriptions": [
"Always show reborrow hints.",
"Never show reborrow hints.",
"Only show mutable reborrow hints."
]
},
{ "type": "boolean" }
], ],
}, },
"CargoFeatures" => set! { "CargoFeatures" => set! {
@ -1709,19 +1727,37 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
], ],
}, },
"Option<CargoFeatures>" => set! { "Option<CargoFeatures>" => set! {
"type": ["string", "array", "null"], "anyOf": [
"items": { "type": "string" }, {
"enum": ["all"], "type": "string",
"enumDescriptions": [ "enum": [
"Pass `--all-features` to cargo", "all"
],
"enumDescriptions": [
"Pass `--all-features` to cargo",
]
},
{
"type": "array",
"items": { "type": "string" }
},
{ "type": "null" }
], ],
}, },
"Option<CallableCompletionDef>" => set! { "Option<CallableCompletionDef>" => set! {
"type": ["string", "null"], "anyOf": [
"enum": ["fill_arguments", "add_parentheses"], {
"enumDescriptions": [ "type": "string",
"Add call parentheses and pre-fill arguments", "enum": [
"Add call parentheses", "fill_arguments",
"add_parentheses"
],
"enumDescriptions": [
"Add call parentheses and pre-fill arguments",
"Add call parentheses"
]
},
{ "type": "null" }
], ],
}, },
"SignatureDetail" => set! { "SignatureDetail" => set! {

View file

@ -491,19 +491,25 @@
"rust-analyzer.checkOnSave.features": { "rust-analyzer.checkOnSave.features": {
"markdownDescription": "List of features to activate. Defaults to\n`#rust-analyzer.cargo.features#`.\n\nSet to `\"all\"` to pass `--all-features` to cargo.", "markdownDescription": "List of features to activate. Defaults to\n`#rust-analyzer.cargo.features#`.\n\nSet to `\"all\"` to pass `--all-features` to cargo.",
"default": null, "default": null,
"type": [ "anyOf": [
"string", {
"array", "type": "string",
"null" "enum": [
], "all"
"items": { ],
"type": "string" "enumDescriptions": [
}, "Pass `--all-features` to cargo"
"enum": [ ]
"all" },
], {
"enumDescriptions": [ "type": "array",
"Pass `--all-features` to cargo" "items": {
"type": "string"
}
},
{
"type": "null"
}
] ]
}, },
"rust-analyzer.checkOnSave.noDefaultFeatures": { "rust-analyzer.checkOnSave.noDefaultFeatures": {
@ -546,17 +552,21 @@
"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",
"type": [ "anyOf": [
"string", {
"null" "type": "string",
], "enum": [
"enum": [ "fill_arguments",
"fill_arguments", "add_parentheses"
"add_parentheses" ],
], "enumDescriptions": [
"enumDescriptions": [ "Add call parentheses and pre-fill arguments",
"Add call parentheses and pre-fill arguments", "Add call parentheses"
"Add call parentheses" ]
},
{
"type": "null"
}
] ]
}, },
"rust-analyzer.completion.postfix.enable": { "rust-analyzer.completion.postfix.enable": {
@ -787,19 +797,23 @@
"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",
"type": [ "anyOf": [
"string", {
"boolean" "type": "string",
], "enum": [
"enum": [ "always",
"always", "never",
"never", "skip_trivial"
"skip_trivial" ],
], "enumDescriptions": [
"enumDescriptions": [ "Always show lifetime elision hints.",
"Always show lifetime elision hints.", "Never show lifetime elision hints.",
"Never show lifetime elision hints.", "Only show lifetime elision hints if a return type is involved."
"Only show lifetime elision hints if a return type is involved." ]
},
{
"type": "boolean"
}
] ]
}, },
"rust-analyzer.inlayHints.lifetimeElisionHints.useParameterNames": { "rust-analyzer.inlayHints.lifetimeElisionHints.useParameterNames": {
@ -824,19 +838,23 @@
"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",
"type": [ "anyOf": [
"string", {
"boolean" "type": "string",
], "enum": [
"enum": [ "always",
"always", "never",
"never", "mutable"
"mutable" ],
], "enumDescriptions": [
"enumDescriptions": [ "Always show reborrow hints.",
"Always show reborrow hints.", "Never show reborrow hints.",
"Never show reborrow hints.", "Only show mutable reborrow hints."
"Only show mutable reborrow hints." ]
},
{
"type": "boolean"
}
] ]
}, },
"rust-analyzer.inlayHints.renderColons": { "rust-analyzer.inlayHints.renderColons": {