diff options
author | asv <[email protected]> | 2021-03-06 11:02:26 +0000 |
---|---|---|
committer | asv <[email protected]> | 2021-03-07 08:15:17 +0000 |
commit | 96fc01a30b88d95619b26fd96c58627dd54cb339 (patch) | |
tree | 2959357aae5a465555a924db44979686999c4b4a /crates/rust-analyzer/src | |
parent | 750d3cb84678b23a55092f2e4726e48ead37a9ff (diff) |
Make group imports configurable
Diffstat (limited to 'crates/rust-analyzer/src')
-rw-r--r-- | crates/rust-analyzer/src/cli/analysis_bench.rs | 6 | ||||
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/src/to_proto.rs | 6 |
3 files changed, 13 insertions, 3 deletions
diff --git a/crates/rust-analyzer/src/cli/analysis_bench.rs b/crates/rust-analyzer/src/cli/analysis_bench.rs index 3bd7e678d..49994824f 100644 --- a/crates/rust-analyzer/src/cli/analysis_bench.rs +++ b/crates/rust-analyzer/src/cli/analysis_bench.rs | |||
@@ -108,7 +108,11 @@ impl BenchCmd { | |||
108 | add_call_parenthesis: true, | 108 | add_call_parenthesis: true, |
109 | add_call_argument_snippets: true, | 109 | add_call_argument_snippets: true, |
110 | snippet_cap: SnippetCap::new(true), | 110 | snippet_cap: SnippetCap::new(true), |
111 | insert_use: InsertUseConfig { merge: None, prefix_kind: PrefixKind::Plain }, | 111 | insert_use: InsertUseConfig { |
112 | merge: None, | ||
113 | prefix_kind: PrefixKind::Plain, | ||
114 | group: true, | ||
115 | }, | ||
112 | }; | 116 | }; |
113 | let res = do_work(&mut host, file_id, |analysis| { | 117 | let res = do_work(&mut host, file_id, |analysis| { |
114 | analysis.completions(&options, file_position) | 118 | analysis.completions(&options, file_position) |
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 367136702..cac48e911 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -35,7 +35,8 @@ config_data! { | |||
35 | assist_importMergeBehaviour: MergeBehaviorDef = "\"full\"", | 35 | assist_importMergeBehaviour: MergeBehaviorDef = "\"full\"", |
36 | /// The path structure for newly inserted paths to use. | 36 | /// The path structure for newly inserted paths to use. |
37 | assist_importPrefix: ImportPrefixDef = "\"plain\"", | 37 | assist_importPrefix: ImportPrefixDef = "\"plain\"", |
38 | 38 | /// Group inserted imports by the [following order](https://rust-analyzer.github.io/manual.html#auto-import). Groups are separated by newlines. | |
39 | assist_importGroup: bool = "true", | ||
39 | /// Show function name and docs in parameter hints. | 40 | /// Show function name and docs in parameter hints. |
40 | callInfo_full: bool = "true", | 41 | callInfo_full: bool = "true", |
41 | 42 | ||
@@ -574,6 +575,7 @@ impl Config { | |||
574 | ImportPrefixDef::ByCrate => PrefixKind::ByCrate, | 575 | ImportPrefixDef::ByCrate => PrefixKind::ByCrate, |
575 | ImportPrefixDef::BySelf => PrefixKind::BySelf, | 576 | ImportPrefixDef::BySelf => PrefixKind::BySelf, |
576 | }, | 577 | }, |
578 | group: self.data.assist_importGroup, | ||
577 | } | 579 | } |
578 | } | 580 | } |
579 | pub fn completion(&self) -> CompletionConfig { | 581 | pub fn completion(&self) -> CompletionConfig { |
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index c1ca88df6..4235eb6dd 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -1087,7 +1087,11 @@ mod tests { | |||
1087 | add_call_parenthesis: true, | 1087 | add_call_parenthesis: true, |
1088 | add_call_argument_snippets: true, | 1088 | add_call_argument_snippets: true, |
1089 | snippet_cap: SnippetCap::new(true), | 1089 | snippet_cap: SnippetCap::new(true), |
1090 | insert_use: InsertUseConfig { merge: None, prefix_kind: PrefixKind::Plain }, | 1090 | insert_use: InsertUseConfig { |
1091 | merge: None, | ||
1092 | prefix_kind: PrefixKind::Plain, | ||
1093 | group: true, | ||
1094 | }, | ||
1091 | }, | 1095 | }, |
1092 | ide_db::base_db::FilePosition { file_id, offset }, | 1096 | ide_db::base_db::FilePosition { file_id, offset }, |
1093 | ) | 1097 | ) |