diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-12-10 15:02:04 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-10 15:02:04 +0000 |
commit | bd785788512d1a90ad7b0363835c4ea7d9c1f4ba (patch) | |
tree | e0dafa1ecf91c07b9946eed4fcf279ed3114cd0e /crates/completion/src/item.rs | |
parent | 83aa6fbd1ef7fd7faf27d8f7fd8679cb85a8097a (diff) | |
parent | 076945e47c22d984067e0ce4d2f2016821e869e2 (diff) |
Merge #6801
6801: Minor, more orthogonal code r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/completion/src/item.rs')
-rw-r--r-- | crates/completion/src/item.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/completion/src/item.rs b/crates/completion/src/item.rs index 83166df4e..65f8353e7 100644 --- a/crates/completion/src/item.rs +++ b/crates/completion/src/item.rs | |||
@@ -271,19 +271,18 @@ impl CompletionItem { | |||
271 | pub struct ImportEdit { | 271 | pub struct ImportEdit { |
272 | pub import_path: ModPath, | 272 | pub import_path: ModPath, |
273 | pub import_scope: ImportScope, | 273 | pub import_scope: ImportScope, |
274 | pub merge_behavior: Option<MergeBehavior>, | ||
275 | } | 274 | } |
276 | 275 | ||
277 | impl ImportEdit { | 276 | impl ImportEdit { |
278 | /// Attempts to insert the import to the given scope, producing a text edit. | 277 | /// Attempts to insert the import to the given scope, producing a text edit. |
279 | /// May return no edit in edge cases, such as scope already containing the import. | 278 | /// May return no edit in edge cases, such as scope already containing the import. |
280 | pub fn to_text_edit(&self) -> Option<TextEdit> { | 279 | pub fn to_text_edit(&self, merge_behavior: Option<MergeBehavior>) -> Option<TextEdit> { |
281 | let _p = profile::span("ImportEdit::to_text_edit"); | 280 | let _p = profile::span("ImportEdit::to_text_edit"); |
282 | 281 | ||
283 | let rewriter = insert_use::insert_use( | 282 | let rewriter = insert_use::insert_use( |
284 | &self.import_scope, | 283 | &self.import_scope, |
285 | mod_path_to_ast(&self.import_path), | 284 | mod_path_to_ast(&self.import_path), |
286 | self.merge_behavior, | 285 | merge_behavior, |
287 | ); | 286 | ); |
288 | let old_ast = rewriter.rewrite_root()?; | 287 | let old_ast = rewriter.rewrite_root()?; |
289 | let mut import_insert = TextEdit::builder(); | 288 | let mut import_insert = TextEdit::builder(); |