aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/context.rs
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-06-02 14:25:02 +0100
committerLukas Wirth <[email protected]>2021-06-02 16:12:36 +0100
commit76fd1b316f38b59991316d5b97582c0203728738 (patch)
treee8572154d505e9eddde4e454ac03dfb06589b464 /crates/ide_completion/src/context.rs
parent9271941a950026836511bd1c85e15e26a480b824 (diff)
Remove obsolete is_new_item field on CompletionContext
Diffstat (limited to 'crates/ide_completion/src/context.rs')
-rw-r--r--crates/ide_completion/src/context.rs14
1 files changed, 1 insertions, 13 deletions
diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs
index eeb4333f8..6f685c02f 100644
--- a/crates/ide_completion/src/context.rs
+++ b/crates/ide_completion/src/context.rs
@@ -78,8 +78,6 @@ pub(crate) struct CompletionContext<'a> {
78 pub(super) can_be_stmt: bool, 78 pub(super) can_be_stmt: bool,
79 /// `true` if we expect an expression at the cursor position. 79 /// `true` if we expect an expression at the cursor position.
80 pub(super) is_expr: bool, 80 pub(super) is_expr: bool,
81 /// Something is typed at the "top" level, in module or impl/trait.
82 pub(super) is_new_item: bool,
83 /// If this is a call (method or function) in particular, i.e. the () are already there. 81 /// If this is a call (method or function) in particular, i.e. the () are already there.
84 pub(super) is_call: bool, 82 pub(super) is_call: bool,
85 /// Like `is_call`, but for tuple patterns. 83 /// Like `is_call`, but for tuple patterns.
@@ -155,7 +153,6 @@ impl<'a> CompletionContext<'a> {
155 path_qual: None, 153 path_qual: None,
156 can_be_stmt: false, 154 can_be_stmt: false,
157 is_expr: false, 155 is_expr: false,
158 is_new_item: false,
159 is_call: false, 156 is_call: false,
160 is_pattern_call: false, 157 is_pattern_call: false,
161 is_macro_call: false, 158 is_macro_call: false,
@@ -552,16 +549,7 @@ impl<'a> CompletionContext<'a> {
552 self.name_ref_syntax = 549 self.name_ref_syntax =
553 find_node_at_offset(original_file, name_ref.syntax().text_range().start()); 550 find_node_at_offset(original_file, name_ref.syntax().text_range().start());
554 551
555 let name_range = name_ref.syntax().text_range(); 552 if matches!(self.completion_location, Some(ImmediateLocation::ItemList)) {
556 let top_node = name_ref
557 .syntax()
558 .ancestors()
559 .take_while(|it| it.text_range() == name_range)
560 .last()
561 .unwrap();
562
563 if matches!(top_node.parent().map(|it| it.kind()), Some(SOURCE_FILE) | Some(ITEM_LIST)) {
564 self.is_new_item = true;
565 return; 553 return;
566 } 554 }
567 555