Merge pull request #21147 from Wilfred/imports_granularity_dropdown

fix: rust-analyzer.imports.granularity.group should get a dropdown UI
This commit is contained in:
Chayim Refael Friedman
2025-11-28 11:30:53 +00:00
committed by GitHub
2 changed files with 20 additions and 41 deletions

View File

@@ -3566,23 +3566,13 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
},
"ImportGranularityDef" => set! {
"type": "string",
"anyOf": [
{
"enum": ["crate", "module", "item", "one"],
"enumDescriptions": [
"Merge imports from the same crate into a single use statement. Conversely, imports from different crates are split into separate statements.",
"Merge imports from the same module into a single use statement. Conversely, imports from different modules are split into separate statements.",
"Flatten imports so that each has its own use statement.",
"Merge all imports into a single use statement as long as they have the same visibility and attributes."
],
},
{
"enum": ["preserve"],
"enumDescriptions": [
"Deprecated - unless `enforceGranularity` is `true`, the style of the current file is preferred over this setting. Behaves like `item`.",
],
"deprecated": true,
}
"enum": ["crate", "module", "item", "one", "preserve"],
"enumDescriptions": [
"Merge imports from the same crate into a single use statement. Conversely, imports from different crates are split into separate statements.",
"Merge imports from the same module into a single use statement. Conversely, imports from different modules are split into separate statements.",
"Flatten imports so that each has its own use statement.",
"Merge all imports into a single use statement as long as they have the same visibility and attributes.",
"Deprecated - unless `enforceGranularity` is `true`, the style of the current file is preferred over this setting. Behaves like `item`."
],
},
"ImportPrefixDef" => set! {

View File

@@ -2020,30 +2020,19 @@
"markdownDescription": "How imports should be grouped into use statements.",
"default": "crate",
"type": "string",
"anyOf": [
{
"enum": [
"crate",
"module",
"item",
"one"
],
"enumDescriptions": [
"Merge imports from the same crate into a single use statement. Conversely, imports from different crates are split into separate statements.",
"Merge imports from the same module into a single use statement. Conversely, imports from different modules are split into separate statements.",
"Flatten imports so that each has its own use statement.",
"Merge all imports into a single use statement as long as they have the same visibility and attributes."
]
},
{
"enum": [
"preserve"
],
"enumDescriptions": [
"Deprecated - unless `enforceGranularity` is `true`, the style of the current file is preferred over this setting. Behaves like `item`."
],
"deprecated": true
}
"enum": [
"crate",
"module",
"item",
"one",
"preserve"
],
"enumDescriptions": [
"Merge imports from the same crate into a single use statement. Conversely, imports from different crates are split into separate statements.",
"Merge imports from the same module into a single use statement. Conversely, imports from different modules are split into separate statements.",
"Flatten imports so that each has its own use statement.",
"Merge all imports into a single use statement as long as they have the same visibility and attributes.",
"Deprecated - unless `enforceGranularity` is `true`, the style of the current file is preferred over this setting. Behaves like `item`."
]
}
}