Start on requesting completions for remote buffers
This commit is contained in:
parent
ae5aebf405
commit
ed549e352f
7 changed files with 191 additions and 16 deletions
|
@ -195,6 +195,13 @@ pub trait File {
|
|||
fn format_remote(&self, buffer_id: u64, cx: &mut MutableAppContext)
|
||||
-> Option<Task<Result<()>>>;
|
||||
|
||||
fn completions(
|
||||
&self,
|
||||
buffer_id: u64,
|
||||
position: Anchor,
|
||||
cx: &mut MutableAppContext,
|
||||
) -> Task<Result<Vec<Completion<Anchor>>>>;
|
||||
|
||||
fn buffer_updated(&self, buffer_id: u64, operation: Operation, cx: &mut MutableAppContext);
|
||||
|
||||
fn buffer_removed(&self, buffer_id: u64, cx: &mut MutableAppContext);
|
||||
|
@ -264,6 +271,15 @@ impl File for FakeFile {
|
|||
None
|
||||
}
|
||||
|
||||
fn completions(
|
||||
&self,
|
||||
_: u64,
|
||||
_: Anchor,
|
||||
_: &mut MutableAppContext,
|
||||
) -> Task<Result<Vec<Completion<Anchor>>>> {
|
||||
Task::ready(Ok(Default::default()))
|
||||
}
|
||||
|
||||
fn buffer_updated(&self, _: u64, _: Operation, _: &mut MutableAppContext) {}
|
||||
|
||||
fn buffer_removed(&self, _: u64, _: &mut MutableAppContext) {}
|
||||
|
@ -1773,7 +1789,7 @@ impl Buffer {
|
|||
})
|
||||
})
|
||||
} else {
|
||||
Task::ready(Ok(Default::default()))
|
||||
file.completions(self.remote_id(), self.anchor_before(position), cx.as_mut())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2555,6 +2571,10 @@ impl<T> Completion<T> {
|
|||
};
|
||||
(kind_key, &self.label()[self.filter_range()])
|
||||
}
|
||||
|
||||
pub fn is_snippet(&self) -> bool {
|
||||
self.lsp_completion.insert_text_format == Some(lsp::InsertTextFormat::SNIPPET)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn contiguous_ranges(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue