aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Kuthe2023-04-04 21:35:31 +0000
committerBlaž Hrastnik2023-05-18 06:16:50 +0000
commit30ff7f8db29d5fc84191268b94ec971e7ca5da5d (patch)
tree5065bcba822f4a827444925f5243e0950f319ebc
parent5406e9f629313221c8ae97583393dfd6221d3dfc (diff)
resolve completions before applying transactions
-rw-r--r--helix-term/src/ui/completion.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs
index dd21be03..7ec4f577 100644
--- a/helix-term/src/ui/completion.rs
+++ b/helix-term/src/ui/completion.rs
@@ -253,6 +253,17 @@ impl Completion {
// always present here
let item = item.unwrap();
+ // apply additional edits, mostly used to auto import unqualified types
+ 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())
+ };
// if more text was entered, remove it
doc.restore(view, &savepoint, true);
@@ -272,17 +283,6 @@ impl Completion {
changes: completion_changes(&transaction, trigger_offset),
});
- // apply additional edits, mostly used to auto import unqualified types
- 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())
- };
if let Some(additional_edits) = resolved_item
.as_ref()
.and_then(|item| item.additional_text_edits.as_ref())