aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer/src/to_proto.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-05-20 09:27:16 +0100
committerGitHub <[email protected]>2021-05-20 09:27:16 +0100
commit8bb37737c9e8b7a390ae29d5fb0daaeeb495d2b5 (patch)
tree0f8d45124abe86151e1954c1766534116e174209 /crates/rust-analyzer/src/to_proto.rs
parent764241e38e46316b6370977e8b51e841e93e84b9 (diff)
parent2bf720900f94e36969af44ff8ac52470faf9af4b (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 'crates/rust-analyzer/src/to_proto.rs')
-rw-r--r--crates/rust-analyzer/src/to_proto.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index 9dec46c78..ef9e0aee9 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -1145,7 +1145,7 @@ mod tests {
1145 1145
1146 use ide::Analysis; 1146 use ide::Analysis;
1147 use ide_db::helpers::{ 1147 use ide_db::helpers::{
1148 insert_use::{InsertUseConfig, PrefixKind}, 1148 insert_use::{ImportGranularity, InsertUseConfig, PrefixKind},
1149 SnippetCap, 1149 SnippetCap,
1150 }; 1150 };
1151 1151
@@ -1177,8 +1177,9 @@ mod tests {
1177 add_call_argument_snippets: true, 1177 add_call_argument_snippets: true,
1178 snippet_cap: SnippetCap::new(true), 1178 snippet_cap: SnippetCap::new(true),
1179 insert_use: InsertUseConfig { 1179 insert_use: InsertUseConfig {
1180 merge: None, 1180 granularity: ImportGranularity::Item,
1181 prefix_kind: PrefixKind::Plain, 1181 prefix_kind: PrefixKind::Plain,
1182 enforce_granularity: true,
1182 group: true, 1183 group: true,
1183 }, 1184 },
1184 }, 1185 },