aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-05-27 14:15:19 +0100
committerBenjamin Coenen <[email protected]>2020-05-27 14:15:19 +0100
commit846cefa4917dc68a85b7b307be5d1890b83e1e2d (patch)
treea47f29d9632730611663c95360c452df7fa008ae /crates
parent0e814a3b5f5c7d034b0249cfb4391d9fcb9d8e42 (diff)
fix textedit range returned for completion when left token is a keyword
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide/src/completion/complete_unqualified_path.rs1
-rw-r--r--crates/ra_ide/src/completion/completion_context.rs2
2 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_ide/src/completion/complete_unqualified_path.rs b/crates/ra_ide/src/completion/complete_unqualified_path.rs
index 417a92001..68032c37e 100644
--- a/crates/ra_ide/src/completion/complete_unqualified_path.rs
+++ b/crates/ra_ide/src/completion/complete_unqualified_path.rs
@@ -299,6 +299,7 @@ mod tests {
299 299
300 #[test] 300 #[test]
301 fn completes_bindings_from_for_with_in_prefix() { 301 fn completes_bindings_from_for_with_in_prefix() {
302 mark::check!(completes_bindings_from_for_with_in_prefix);
302 assert_debug_snapshot!( 303 assert_debug_snapshot!(
303 do_reference_completion( 304 do_reference_completion(
304 r" 305 r"
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs
index e8bf07d6e..c4646b727 100644
--- a/crates/ra_ide/src/completion/completion_context.rs
+++ b/crates/ra_ide/src/completion/completion_context.rs
@@ -12,6 +12,7 @@ use ra_syntax::{
12use ra_text_edit::Indel; 12use ra_text_edit::Indel;
13 13
14use crate::{call_info::ActiveParameter, completion::CompletionConfig, FilePosition}; 14use crate::{call_info::ActiveParameter, completion::CompletionConfig, FilePosition};
15use test_utils::mark;
15 16
16/// `CompletionContext` is created early during completion to figure out, where 17/// `CompletionContext` is created early during completion to figure out, where
17/// exactly is the cursor, syntax-wise. 18/// exactly is the cursor, syntax-wise.
@@ -174,6 +175,7 @@ impl<'a> CompletionContext<'a> {
174 if self.token.kind().is_keyword() 175 if self.token.kind().is_keyword()
175 && self.offset == self.original_token.text_range().end() 176 && self.offset == self.original_token.text_range().end()
176 { 177 {
178 mark::hit!(completes_bindings_from_for_with_in_prefix);
177 TextRange::empty(self.original_token.text_range().start()) 179 TextRange::empty(self.original_token.text_range().start())
178 } else { 180 } else {
179 TextRange::empty(self.offset) 181 TextRange::empty(self.offset)