Auto merge of #16372 - davidsemakula:import-granularity-one, r=Veykril

feat: Add "One" import granularity

Adds a new import granularity option "One" that merges all imports into a single use statement as long as they have the same visibility and attributes.

This is similar to [rustfmt's `imports_granularity = "One"`](https://rust-lang.github.io/rustfmt/?version=v1.6.0&search=import#imports_granularity).

Fixes: #11361
This commit is contained in:
bors 2024-01-18 15:40:12 +00:00
commit 3f4c6dac3d
10 changed files with 473 additions and 85 deletions

View file

@ -1120,13 +1120,15 @@
"preserve",
"crate",
"module",
"item"
"item",
"one"
],
"enumDescriptions": [
"Do not change the granularity of any imports and preserve the original structure written by the developer.",
"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."
"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."
]
},
"rust-analyzer.imports.group.enable": {