about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-05-12 16:16:20 +0000
committerbors <bors@rust-lang.org>2022-05-12 16:16:20 +0000
commitf8c0062d4eb82311152c6414eca5ebf0621b1da8 (patch)
tree93cec4a1ea4635a1f86fcc80613bd14b1291e3a5
parent14910134172bdf55b97a741dc64ada1558302492 (diff)
parentd57beac7e6266a9b901c62a84a557aab04484698 (diff)
downloadrust-f8c0062d4eb82311152c6414eca5ebf0621b1da8.tar.gz
rust-f8c0062d4eb82311152c6414eca5ebf0621b1da8.zip
Auto merge of #12229 - Veykril:configfix, r=Veykril
fix: Fix vscode config descriptions not recognizing all valid values
-rw-r--r--crates/rust-analyzer/src/config.rs80
-rw-r--r--editors/code/package.json118
2 files changed, 126 insertions, 72 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 58b73eb72fd..abc1541b536 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -1683,21 +1683,39 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
             "maximum": 255
         },
         "LifetimeElisionDef" => set! {
-            "type": ["string", "boolean"],
-            "enum": ["always", "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."
+            "anyOf": [
+                {
+                    "type": "string",
+                    "enum": [
+                        "always",
+                        "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! {
-            "type": ["string", "boolean"],
-            "enum": ["always", "never", "mutable"],
-            "enumDescriptions": [
-                "Always show reborrow hints.",
-                "Never show reborrow hints.",
-                "Only show mutable reborrow hints."
+            "anyOf": [
+                {
+                    "type": "string",
+                    "enum": [
+                        "always",
+                        "never",
+                        "mutable"
+                    ],
+                    "enumDescriptions": [
+                        "Always show reborrow hints.",
+                        "Never show reborrow hints.",
+                        "Only show mutable reborrow hints."
+                    ]
+                },
+                { "type": "boolean" }
             ],
         },
         "CargoFeatures" => set! {
@@ -1709,19 +1727,37 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
             ],
         },
         "Option<CargoFeatures>" => set! {
-            "type": ["string", "array", "null"],
-            "items": { "type": "string" },
-            "enum": ["all"],
-            "enumDescriptions": [
-                "Pass `--all-features` to cargo",
+            "anyOf": [
+                {
+                    "type": "string",
+                    "enum": [
+                        "all"
+                    ],
+                    "enumDescriptions": [
+                        "Pass `--all-features` to cargo",
+                    ]
+                },
+                {
+                    "type": "array",
+                    "items": { "type": "string" }
+                },
+                { "type": "null" }
             ],
         },
         "Option<CallableCompletionDef>" => set! {
-            "type": ["string", "null"],
-            "enum": ["fill_arguments", "add_parentheses"],
-            "enumDescriptions": [
-                "Add call parentheses and pre-fill arguments",
-                "Add call parentheses",
+            "anyOf": [
+                {
+                    "type": "string",
+                    "enum": [
+                        "fill_arguments",
+                        "add_parentheses"
+                    ],
+                    "enumDescriptions": [
+                        "Add call parentheses and pre-fill arguments",
+                        "Add call parentheses"
+                    ]
+                },
+                { "type": "null" }
             ],
         },
         "SignatureDetail" => set! {
diff --git a/editors/code/package.json b/editors/code/package.json
index 1cc510758f3..7fa04fbb9a7 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -491,19 +491,25 @@
                 "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.",
                     "default": null,
-                    "type": [
-                        "string",
-                        "array",
-                        "null"
-                    ],
-                    "items": {
-                        "type": "string"
-                    },
-                    "enum": [
-                        "all"
-                    ],
-                    "enumDescriptions": [
-                        "Pass `--all-features` to cargo"
+                    "anyOf": [
+                        {
+                            "type": "string",
+                            "enum": [
+                                "all"
+                            ],
+                            "enumDescriptions": [
+                                "Pass `--all-features` to cargo"
+                            ]
+                        },
+                        {
+                            "type": "array",
+                            "items": {
+                                "type": "string"
+                            }
+                        },
+                        {
+                            "type": "null"
+                        }
                     ]
                 },
                 "rust-analyzer.checkOnSave.noDefaultFeatures": {
@@ -546,17 +552,21 @@
                 "rust-analyzer.completion.callable.snippets": {
                     "markdownDescription": "Whether to add parenthesis and argument snippets when completing function.",
                     "default": "fill_arguments",
-                    "type": [
-                        "string",
-                        "null"
-                    ],
-                    "enum": [
-                        "fill_arguments",
-                        "add_parentheses"
-                    ],
-                    "enumDescriptions": [
-                        "Add call parentheses and pre-fill arguments",
-                        "Add call parentheses"
+                    "anyOf": [
+                        {
+                            "type": "string",
+                            "enum": [
+                                "fill_arguments",
+                                "add_parentheses"
+                            ],
+                            "enumDescriptions": [
+                                "Add call parentheses and pre-fill arguments",
+                                "Add call parentheses"
+                            ]
+                        },
+                        {
+                            "type": "null"
+                        }
                     ]
                 },
                 "rust-analyzer.completion.postfix.enable": {
@@ -787,19 +797,23 @@
                 "rust-analyzer.inlayHints.lifetimeElisionHints.enable": {
                     "markdownDescription": "Whether to show inlay type hints for elided lifetimes in function signatures.",
                     "default": "never",
-                    "type": [
-                        "string",
-                        "boolean"
-                    ],
-                    "enum": [
-                        "always",
-                        "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."
+                    "anyOf": [
+                        {
+                            "type": "string",
+                            "enum": [
+                                "always",
+                                "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"
+                        }
                     ]
                 },
                 "rust-analyzer.inlayHints.lifetimeElisionHints.useParameterNames": {
@@ -824,19 +838,23 @@
                 "rust-analyzer.inlayHints.reborrowHints.enable": {
                     "markdownDescription": "Whether to show inlay type hints for compiler inserted reborrows.",
                     "default": "never",
-                    "type": [
-                        "string",
-                        "boolean"
-                    ],
-                    "enum": [
-                        "always",
-                        "never",
-                        "mutable"
-                    ],
-                    "enumDescriptions": [
-                        "Always show reborrow hints.",
-                        "Never show reborrow hints.",
-                        "Only show mutable reborrow hints."
+                    "anyOf": [
+                        {
+                            "type": "string",
+                            "enum": [
+                                "always",
+                                "never",
+                                "mutable"
+                            ],
+                            "enumDescriptions": [
+                                "Always show reborrow hints.",
+                                "Never show reborrow hints.",
+                                "Only show mutable reborrow hints."
+                            ]
+                        },
+                        {
+                            "type": "boolean"
+                        }
                     ]
                 },
                 "rust-analyzer.inlayHints.renderColons": {