diff options
Diffstat (limited to 'crates/ra_ide/src/completion/completion_context.rs')
-rw-r--r-- | crates/ra_ide/src/completion/completion_context.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index da336973c..e8bf07d6e 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs | |||
@@ -169,7 +169,16 @@ impl<'a> CompletionContext<'a> { | |||
169 | match self.token.kind() { | 169 | match self.token.kind() { |
170 | // workaroud when completion is triggered by trigger characters. | 170 | // workaroud when completion is triggered by trigger characters. |
171 | IDENT => self.original_token.text_range(), | 171 | IDENT => self.original_token.text_range(), |
172 | _ => TextRange::empty(self.offset), | 172 | _ => { |
173 | // If we haven't characters between keyword and our cursor we take the keyword start range to edit | ||
174 | if self.token.kind().is_keyword() | ||
175 | && self.offset == self.original_token.text_range().end() | ||
176 | { | ||
177 | TextRange::empty(self.original_token.text_range().start()) | ||
178 | } else { | ||
179 | TextRange::empty(self.offset) | ||
180 | } | ||
181 | } | ||
173 | } | 182 | } |
174 | } | 183 | } |
175 | 184 | ||