From 4ce4c0ef033f72c83e1f8647ce4b69499aa5a70c Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 9 Jun 2022 13:08:08 -0700 Subject: [PATCH] Ignore completions from gopls that we can't yet handle We only support additionalEdits if they are provided when resolving the completion, not if they are provided immediately. --- crates/project/src/project.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 775b7f2ec2..be79b8b3e6 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -3054,6 +3054,16 @@ impl Project { Ok(completions .into_iter() .filter_map(|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; + } + let (old_range, 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.