diff options
Diffstat (limited to 'crates/ra_ide_api/src/completion/completion_context.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/completion_context.rs | 6 |
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)] |
15 | pub(super) struct CompletionContext<'a> { | 15 | pub(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 |