Do not resolve completions if extra edits are available

This commit is contained in:
Kirill Bulatov 2023-07-12 19:29:20 +03:00
parent 6d96c6ef51
commit c732aa1617
3 changed files with 98 additions and 15 deletions

View file

@ -1349,6 +1349,7 @@ impl LspCommand for GetCompletions {
} else {
Default::default()
};
let completions = buffer.read_with(&cx, |buffer, _| {
let language = buffer.language().cloned();
let snapshot = buffer.snapshot();
@ -1357,17 +1358,6 @@ impl LspCommand for GetCompletions {
completions
.into_iter()
.filter_map(move |mut lsp_completion| {
// 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
// check that the range is valid.