Draft the postfix completions support

This commit is contained in:
Kirill Bulatov 2023-07-12 18:32:03 +03:00
parent 99c2395a86
commit 6d96c6ef51
2 changed files with 101 additions and 10 deletions

View file

@ -1349,7 +1349,6 @@ impl LspCommand for GetCompletions {
} else {
Default::default()
};
let completions = buffer.read_with(&cx, |buffer, _| {
let language = buffer.language().cloned();
let snapshot = buffer.snapshot();
@ -1358,15 +1357,16 @@ impl LspCommand for GetCompletions {
completions
.into_iter()
.filter_map(move |mut lsp_completion| {
// For now, we can only handle additional edits if they are returned
// when resolving the completion, not if they are present initially.
if lsp_completion
.additional_text_edits
.as_ref()
.map_or(false, |edits| !edits.is_empty())
{
return None;
}
// TODO kb store these? at least, should only allow this when we have resolve
// // For now, we can only handle additional edits if they are returned
// // when resolving the completion, not if they are present initially.
// if lsp_completion
// .additional_text_edits
// .as_ref()
// .map_or(false, |edits| !edits.is_empty())
// {
// return None;
// }
let (old_range, mut new_text) = match lsp_completion.text_edit.as_ref() {
// If the language server provides a range to overwrite, then