aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion
diff options
context:
space:
mode:
authorgfreezy <[email protected]>2019-01-20 05:34:16 +0000
committergfreezy <[email protected]>2019-01-20 05:34:16 +0000
commitecc5a2e3df178194a25b85f90eb84e4386ed246d (patch)
tree95b81619577d8b41b61214dc7b18fc74bce30b0a /crates/ra_ide_api/src/completion
parent2a43638052213d1faa690e6d68bd5702e44fa027 (diff)
workaround for trigger character
Diffstat (limited to 'crates/ra_ide_api/src/completion')
-rw-r--r--crates/ra_ide_api/src/completion/completion_context.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_ide_api/src/completion/completion_context.rs b/crates/ra_ide_api/src/completion/completion_context.rs
index fd4cfc944..7bc2def14 100644
--- a/crates/ra_ide_api/src/completion/completion_context.rs
+++ b/crates/ra_ide_api/src/completion/completion_context.rs
@@ -69,7 +69,11 @@ impl<'a> CompletionContext<'a> {
69 // This is purely advisory and can be used, for example, to highlight this range in the editor. 69 // This is purely advisory and can be used, for example, to highlight this range in the editor.
70 // Clients are expected to ignore this field. 70 // Clients are expected to ignore this field.
71 pub(crate) fn source_range(&self) -> TextRange { 71 pub(crate) fn source_range(&self) -> TextRange {
72 self.leaf.range() 72 match self.leaf.kind() {
73 // workaroud when completion is triggered by trigger characters.
74 DOT | COLONCOLON => TextRange::from_to(self.offset, self.offset),
75 _ => self.leaf.range()
76 }
73 } 77 }
74 78
75 fn fill(&mut self, original_file: &'a SourceFile, offset: TextUnit) { 79 fn fill(&mut self, original_file: &'a SourceFile, offset: TextUnit) {