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"], {
"type": "string",
"enum": [
"always",
"never",
"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" }
], ],
}, },
"ReborrowHintsDef" => set! { "ReborrowHintsDef" => set! {
"type": ["string", "boolean"], "anyOf": [
"enum": ["always", "never", "mutable"], {
"type": "string",
"enum": [
"always",
"never",
"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" }
], ],
}, },
"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",
"enum": [
"all"
],
"enumDescriptions": [ "enumDescriptions": [
"Pass `--all-features` to cargo", "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"], {
"type": "string",
"enum": [
"fill_arguments",
"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" }
], ],
}, },
"SignatureDetail" => set! { "SignatureDetail" => set! {

View file

@ -491,14 +491,9 @@
"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"
],
"items": {
"type": "string"
},
"enum": [ "enum": [
"all" "all"
], ],
@ -506,6 +501,17 @@
"Pass `--all-features` to cargo" "Pass `--all-features` to cargo"
] ]
}, },
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "null"
}
]
},
"rust-analyzer.checkOnSave.noDefaultFeatures": { "rust-analyzer.checkOnSave.noDefaultFeatures": {
"markdownDescription": "Do not activate the `default` feature.", "markdownDescription": "Do not activate the `default` feature.",
"default": null, "default": null,
@ -546,10 +552,9 @@
"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"
@ -559,6 +564,11 @@
"Add call parentheses" "Add call parentheses"
] ]
}, },
{
"type": "null"
}
]
},
"rust-analyzer.completion.postfix.enable": { "rust-analyzer.completion.postfix.enable": {
"markdownDescription": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc.", "markdownDescription": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc.",
"default": true, "default": true,
@ -787,10 +797,9 @@
"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",
@ -802,6 +811,11 @@
"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": {
"markdownDescription": "Whether to prefer using parameter names as the name for elided lifetime hints if possible.", "markdownDescription": "Whether to prefer using parameter names as the name for elided lifetime hints if possible.",
"default": false, "default": false,
@ -824,10 +838,9 @@
"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",
@ -839,6 +852,11 @@
"Only show mutable reborrow hints." "Only show mutable reborrow hints."
] ]
}, },
{
"type": "boolean"
}
]
},
"rust-analyzer.inlayHints.renderColons": { "rust-analyzer.inlayHints.renderColons": {
"markdownDescription": "Whether to render leading colons for type hints, and trailing colons for parameter hints.", "markdownDescription": "Whether to render leading colons for type hints, and trailing colons for parameter hints.",
"default": true, "default": true,