Insert completion text on enter

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-01-31 13:46:50 -08:00
parent 071a55a7ab
commit 8d2b7ba032
4 changed files with 64 additions and 14 deletions

View file

@ -114,10 +114,10 @@ pub struct Diagnostic {
pub is_disk_based: bool,
}
pub struct Completion {
old_range: Range<Anchor>,
new_text: String,
lsp_completion: lsp::CompletionItem,
pub struct Completion<T> {
pub old_range: Range<T>,
pub new_text: String,
pub lsp_completion: lsp::CompletionItem,
}
struct LanguageServerState {
@ -1622,7 +1622,7 @@ impl Buffer {
&self,
position: T,
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<Completion>>>
) -> Task<Result<Vec<Completion<Anchor>>>>
where
T: ToOffset,
{
@ -2424,7 +2424,7 @@ impl Default for Diagnostic {
}
}
impl Completion {
impl<T> Completion<T> {
pub fn label(&self) -> &str {
&self.lsp_completion.label
}