Skip to content

Commit f8c0062

Browse files
committed
Auto merge of rust-lang#12229 - Veykril:configfix, r=Veykril
fix: Fix vscode config descriptions not recognizing all valid values
2 parents 1491013 + d57beac commit f8c0062

File tree

2 files changed

+126
-72
lines changed

2 files changed

+126
-72
lines changed

crates/rust-analyzer/src/config.rs

+58-22
Original file line numberDiff line numberDiff line change
@@ -1683,21 +1683,39 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
16831683
"maximum": 255
16841684
},
16851685
"LifetimeElisionDef" => set! {
1686-
"type": ["string", "boolean"],
1687-
"enum": ["always", "never", "skip_trivial"],
1688-
"enumDescriptions": [
1689-
"Always show lifetime elision hints.",
1690-
"Never show lifetime elision hints.",
1691-
"Only show lifetime elision hints if a return type is involved."
1686+
"anyOf": [
1687+
{
1688+
"type": "string",
1689+
"enum": [
1690+
"always",
1691+
"never",
1692+
"skip_trivial"
1693+
],
1694+
"enumDescriptions": [
1695+
"Always show lifetime elision hints.",
1696+
"Never show lifetime elision hints.",
1697+
"Only show lifetime elision hints if a return type is involved."
1698+
]
1699+
},
1700+
{ "type": "boolean" }
16921701
],
16931702
},
16941703
"ReborrowHintsDef" => set! {
1695-
"type": ["string", "boolean"],
1696-
"enum": ["always", "never", "mutable"],
1697-
"enumDescriptions": [
1698-
"Always show reborrow hints.",
1699-
"Never show reborrow hints.",
1700-
"Only show mutable reborrow hints."
1704+
"anyOf": [
1705+
{
1706+
"type": "string",
1707+
"enum": [
1708+
"always",
1709+
"never",
1710+
"mutable"
1711+
],
1712+
"enumDescriptions": [
1713+
"Always show reborrow hints.",
1714+
"Never show reborrow hints.",
1715+
"Only show mutable reborrow hints."
1716+
]
1717+
},
1718+
{ "type": "boolean" }
17011719
],
17021720
},
17031721
"CargoFeatures" => set! {
@@ -1709,19 +1727,37 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
17091727
],
17101728
},
17111729
"Option<CargoFeatures>" => set! {
1712-
"type": ["string", "array", "null"],
1713-
"items": { "type": "string" },
1714-
"enum": ["all"],
1715-
"enumDescriptions": [
1716-
"Pass `--all-features` to cargo",
1730+
"anyOf": [
1731+
{
1732+
"type": "string",
1733+
"enum": [
1734+
"all"
1735+
],
1736+
"enumDescriptions": [
1737+
"Pass `--all-features` to cargo",
1738+
]
1739+
},
1740+
{
1741+
"type": "array",
1742+
"items": { "type": "string" }
1743+
},
1744+
{ "type": "null" }
17171745
],
17181746
},
17191747
"Option<CallableCompletionDef>" => set! {
1720-
"type": ["string", "null"],
1721-
"enum": ["fill_arguments", "add_parentheses"],
1722-
"enumDescriptions": [
1723-
"Add call parentheses and pre-fill arguments",
1724-
"Add call parentheses",
1748+
"anyOf": [
1749+
{
1750+
"type": "string",
1751+
"enum": [
1752+
"fill_arguments",
1753+
"add_parentheses"
1754+
],
1755+
"enumDescriptions": [
1756+
"Add call parentheses and pre-fill arguments",
1757+
"Add call parentheses"
1758+
]
1759+
},
1760+
{ "type": "null" }
17251761
],
17261762
},
17271763
"SignatureDetail" => set! {

editors/code/package.json

+68-50
Original file line numberDiff line numberDiff line change
@@ -491,19 +491,25 @@
491491
"rust-analyzer.checkOnSave.features": {
492492
"markdownDescription": "List of features to activate. Defaults to\n`#rust-analyzer.cargo.features#`.\n\nSet to `\"all\"` to pass `--all-features` to cargo.",
493493
"default": null,
494-
"type": [
495-
"string",
496-
"array",
497-
"null"
498-
],
499-
"items": {
500-
"type": "string"
501-
},
502-
"enum": [
503-
"all"
504-
],
505-
"enumDescriptions": [
506-
"Pass `--all-features` to cargo"
494+
"anyOf": [
495+
{
496+
"type": "string",
497+
"enum": [
498+
"all"
499+
],
500+
"enumDescriptions": [
501+
"Pass `--all-features` to cargo"
502+
]
503+
},
504+
{
505+
"type": "array",
506+
"items": {
507+
"type": "string"
508+
}
509+
},
510+
{
511+
"type": "null"
512+
}
507513
]
508514
},
509515
"rust-analyzer.checkOnSave.noDefaultFeatures": {
@@ -546,17 +552,21 @@
546552
"rust-analyzer.completion.callable.snippets": {
547553
"markdownDescription": "Whether to add parenthesis and argument snippets when completing function.",
548554
"default": "fill_arguments",
549-
"type": [
550-
"string",
551-
"null"
552-
],
553-
"enum": [
554-
"fill_arguments",
555-
"add_parentheses"
556-
],
557-
"enumDescriptions": [
558-
"Add call parentheses and pre-fill arguments",
559-
"Add call parentheses"
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+
}
560570
]
561571
},
562572
"rust-analyzer.completion.postfix.enable": {
@@ -787,19 +797,23 @@
787797
"rust-analyzer.inlayHints.lifetimeElisionHints.enable": {
788798
"markdownDescription": "Whether to show inlay type hints for elided lifetimes in function signatures.",
789799
"default": "never",
790-
"type": [
791-
"string",
792-
"boolean"
793-
],
794-
"enum": [
795-
"always",
796-
"never",
797-
"skip_trivial"
798-
],
799-
"enumDescriptions": [
800-
"Always show lifetime elision hints.",
801-
"Never show lifetime elision hints.",
802-
"Only show lifetime elision hints if a return type is involved."
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+
}
803817
]
804818
},
805819
"rust-analyzer.inlayHints.lifetimeElisionHints.useParameterNames": {
@@ -824,19 +838,23 @@
824838
"rust-analyzer.inlayHints.reborrowHints.enable": {
825839
"markdownDescription": "Whether to show inlay type hints for compiler inserted reborrows.",
826840
"default": "never",
827-
"type": [
828-
"string",
829-
"boolean"
830-
],
831-
"enum": [
832-
"always",
833-
"never",
834-
"mutable"
835-
],
836-
"enumDescriptions": [
837-
"Always show reborrow hints.",
838-
"Never show reborrow hints.",
839-
"Only show mutable reborrow hints."
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+
}
840858
]
841859
},
842860
"rust-analyzer.inlayHints.renderColons": {

0 commit comments

Comments
 (0)