Skip to content

Commit 81cff93

Browse files
Merge pull request #21147 from Wilfred/imports_granularity_dropdown
fix: rust-analyzer.imports.granularity.group should get a dropdown UI
2 parents d31e27f + 0b725f3 commit 81cff93

File tree

2 files changed

+20
-41
lines changed

2 files changed

+20
-41
lines changed

src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3566,23 +3566,13 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
35663566
},
35673567
"ImportGranularityDef" => set! {
35683568
"type": "string",
3569-
"anyOf": [
3570-
{
3571-
"enum": ["crate", "module", "item", "one"],
3572-
"enumDescriptions": [
3573-
"Merge imports from the same crate into a single use statement. Conversely, imports from different crates are split into separate statements.",
3574-
"Merge imports from the same module into a single use statement. Conversely, imports from different modules are split into separate statements.",
3575-
"Flatten imports so that each has its own use statement.",
3576-
"Merge all imports into a single use statement as long as they have the same visibility and attributes."
3577-
],
3578-
},
3579-
{
3580-
"enum": ["preserve"],
3581-
"enumDescriptions": [
3582-
"Deprecated - unless `enforceGranularity` is `true`, the style of the current file is preferred over this setting. Behaves like `item`.",
3583-
],
3584-
"deprecated": true,
3585-
}
3569+
"enum": ["crate", "module", "item", "one", "preserve"],
3570+
"enumDescriptions": [
3571+
"Merge imports from the same crate into a single use statement. Conversely, imports from different crates are split into separate statements.",
3572+
"Merge imports from the same module into a single use statement. Conversely, imports from different modules are split into separate statements.",
3573+
"Flatten imports so that each has its own use statement.",
3574+
"Merge all imports into a single use statement as long as they have the same visibility and attributes.",
3575+
"Deprecated - unless `enforceGranularity` is `true`, the style of the current file is preferred over this setting. Behaves like `item`."
35863576
],
35873577
},
35883578
"ImportPrefixDef" => set! {

src/tools/rust-analyzer/editors/code/package.json

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,30 +2020,19 @@
20202020
"markdownDescription": "How imports should be grouped into use statements.",
20212021
"default": "crate",
20222022
"type": "string",
2023-
"anyOf": [
2024-
{
2025-
"enum": [
2026-
"crate",
2027-
"module",
2028-
"item",
2029-
"one"
2030-
],
2031-
"enumDescriptions": [
2032-
"Merge imports from the same crate into a single use statement. Conversely, imports from different crates are split into separate statements.",
2033-
"Merge imports from the same module into a single use statement. Conversely, imports from different modules are split into separate statements.",
2034-
"Flatten imports so that each has its own use statement.",
2035-
"Merge all imports into a single use statement as long as they have the same visibility and attributes."
2036-
]
2037-
},
2038-
{
2039-
"enum": [
2040-
"preserve"
2041-
],
2042-
"enumDescriptions": [
2043-
"Deprecated - unless `enforceGranularity` is `true`, the style of the current file is preferred over this setting. Behaves like `item`."
2044-
],
2045-
"deprecated": true
2046-
}
2023+
"enum": [
2024+
"crate",
2025+
"module",
2026+
"item",
2027+
"one",
2028+
"preserve"
2029+
],
2030+
"enumDescriptions": [
2031+
"Merge imports from the same crate into a single use statement. Conversely, imports from different crates are split into separate statements.",
2032+
"Merge imports from the same module into a single use statement. Conversely, imports from different modules are split into separate statements.",
2033+
"Flatten imports so that each has its own use statement.",
2034+
"Merge all imports into a single use statement as long as they have the same visibility and attributes.",
2035+
"Deprecated - unless `enforceGranularity` is `true`, the style of the current file is preferred over this setting. Behaves like `item`."
20472036
]
20482037
}
20492038
}

0 commit comments

Comments
 (0)