aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion/completion_context.rs
diff options
context:
space:
mode:
authorgfreezy <[email protected]>2019-01-19 14:02:50 +0000
committergfreezy <[email protected]>2019-01-19 14:02:50 +0000
commitd08e81cdd818dd3378c292767e15a38e6bbc6f6c (patch)
treee07b3363f21912ca7aaca4ae1dce482c0bcd6f85 /crates/ra_ide_api/src/completion/completion_context.rs
parentfa43ef30f4f96fc8e4ea1f9c4492bcb07b3335ca (diff)
refactor completions to use TextEdit instead of InsertText
Diffstat (limited to 'crates/ra_ide_api/src/completion/completion_context.rs')
-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 e537e0082..de9b95c81 100644
--- a/crates/ra_ide_api/src/completion/completion_context.rs
+++ b/crates/ra_ide_api/src/completion/completion_context.rs
@@ -12,7 +12,7 @@ use crate::{db, FilePosition};
12/// `CompletionContext` is created early during completion to figure out, where 12/// `CompletionContext` is created early during completion to figure out, where
13/// exactly is the cursor, syntax-wise. 13/// exactly is the cursor, syntax-wise.
14#[derive(Debug)] 14#[derive(Debug)]
15pub(super) struct CompletionContext<'a> { 15pub(crate) struct CompletionContext<'a> {
16 pub(super) db: &'a db::RootDatabase, 16 pub(super) db: &'a db::RootDatabase,
17 pub(super) offset: TextUnit, 17 pub(super) offset: TextUnit,
18 pub(super) leaf: &'a SyntaxNode, 18 pub(super) leaf: &'a SyntaxNode,
@@ -65,6 +65,10 @@ impl<'a> CompletionContext<'a> {
65 Some(ctx) 65 Some(ctx)
66 } 66 }
67 67
68 pub(crate) fn leaf_range(&self) -> TextRange {
69 self.leaf.range()
70 }
71
68 fn fill(&mut self, original_file: &'a SourceFile, offset: TextUnit) { 72 fn fill(&mut self, original_file: &'a SourceFile, offset: TextUnit) {
69 // Insert a fake ident to get a valid parse tree. We will use this file 73 // Insert a fake ident to get a valid parse tree. We will use this file
70 // to determine context, though the original_file will be used for 74 // to determine context, though the original_file will be used for