diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-20 09:27:16 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-20 09:27:16 +0100 |
commit | 8bb37737c9e8b7a390ae29d5fb0daaeeb495d2b5 (patch) | |
tree | 0f8d45124abe86151e1954c1766534116e174209 /docs/user | |
parent | 764241e38e46316b6370977e8b51e841e93e84b9 (diff) | |
parent | 2bf720900f94e36969af44ff8ac52470faf9af4b (diff) |
Merge #8873
8873: Implement import-granularity guessing r=matklad a=Veykril
This renames our `MergeBehavior` to `ImportGranularity` as rustfmt has it as the purpose of them are basically the same. `ImportGranularity::Preserve` currently has no specific purpose for us as we don't have an organize imports assist yet, so it currently acts the same as `ImportGranularity::Item`.
We now try to guess the import style on a per file basis and fall back to the user granularity setting if the file has no specific style yet or where it is ambiguous. This can be turned off by setting `import.enforceGranularity` to `true`.
Closes https://github.com/rust-analyzer/rust-analyzer/issues/8870
Co-authored-by: Lukas Tobias Wirth <[email protected]>
Diffstat (limited to 'docs/user')
-rw-r--r-- | docs/user/generated_config.adoc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc index b32411887..c02bab7cc 100644 --- a/docs/user/generated_config.adoc +++ b/docs/user/generated_config.adoc | |||
@@ -1,7 +1,12 @@ | |||
1 | [[rust-analyzer.assist.importMergeBehavior]]rust-analyzer.assist.importMergeBehavior (default: `"crate"`):: | 1 | [[rust-analyzer.assist.importGranularity]]rust-analyzer.assist.importGranularity (default: `"crate"`):: |
2 | + | 2 | + |
3 | -- | 3 | -- |
4 | The strategy to use when inserting new imports or merging imports. | 4 | How imports should be grouped into use statements. |
5 | -- | ||
6 | [[rust-analyzer.assist.importEnforceGranularity]]rust-analyzer.assist.importEnforceGranularity (default: `false`):: | ||
7 | + | ||
8 | -- | ||
9 | Whether to enforce the import granularity setting for all files. If set to false rust-analyzer will try to keep import styles consistent per file. | ||
5 | -- | 10 | -- |
6 | [[rust-analyzer.assist.importPrefix]]rust-analyzer.assist.importPrefix (default: `"plain"`):: | 11 | [[rust-analyzer.assist.importPrefix]]rust-analyzer.assist.importPrefix (default: `"plain"`):: |
7 | + | 12 | + |