aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authorAndrey Tkachenko2022-04-16 01:43:54 +0000
committerGitHub2022-04-16 01:43:54 +0000
commitdc8fef5dd311e239150dfcd62c90cc84ee32a8a0 (patch)
tree480a71e2a74bc532f08850b44d5ca48d1089090a /helix-term/src/ui
parentb04c425c63d03f8320eb47ab6e38e4bb79763248 (diff)
Fixes #1991 LSP Auto-import (#2088)
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/completion.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs
index 1ee4a01a..556273bc 100644
--- a/helix-term/src/ui/completion.rs
+++ b/helix-term/src/ui/completion.rs
@@ -178,17 +178,21 @@ impl Completion {
});
// apply additional edits, mostly used to auto import unqualified types
- let resolved_additional_text_edits = if item.additional_text_edits.is_some() {
+ let resolved_item = if item
+ .additional_text_edits
+ .as_ref()
+ .map(|edits| !edits.is_empty())
+ .unwrap_or(false)
+ {
None
} else {
Self::resolve_completion_item(doc, item.clone())
- .and_then(|item| item.additional_text_edits)
};
- if let Some(additional_edits) = item
- .additional_text_edits
+ if let Some(additional_edits) = resolved_item
.as_ref()
- .or(resolved_additional_text_edits.as_ref())
+ .and_then(|item| item.additional_text_edits.as_ref())
+ .or(item.additional_text_edits.as_ref())
{
if !additional_edits.is_empty() {
let transaction = util::generate_transaction_from_edits(