refactor completions to use TextEdit instead of InsertText
This commit is contained in:
@@ -12,7 +12,7 @@ use crate::{db, FilePosition};
|
||||
/// `CompletionContext` is created early during completion to figure out, where
|
||||
/// exactly is the cursor, syntax-wise.
|
||||
#[derive(Debug)]
|
||||
pub(super) struct CompletionContext<'a> {
|
||||
pub(crate) struct CompletionContext<'a> {
|
||||
pub(super) db: &'a db::RootDatabase,
|
||||
pub(super) offset: TextUnit,
|
||||
pub(super) leaf: &'a SyntaxNode,
|
||||
@@ -65,6 +65,10 @@ impl<'a> CompletionContext<'a> {
|
||||
Some(ctx)
|
||||
}
|
||||
|
||||
pub(crate) fn leaf_range(&self) -> TextRange {
|
||||
self.leaf.range()
|
||||
}
|
||||
|
||||
fn fill(&mut self, original_file: &'a SourceFile, offset: TextUnit) {
|
||||
// Insert a fake ident to get a valid parse tree. We will use this file
|
||||
// to determine context, though the original_file will be used for
|
||||
|
||||
Reference in New Issue
Block a user