mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 17:36:19 +04:00
resolve completions before applying transactions
This commit is contained in:
parent
5406e9f629
commit
30ff7f8db2
@ -253,6 +253,17 @@ fn completion_changes(transaction: &Transaction, trigger_offset: usize) -> Vec<C
|
||||
// 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 @@ fn completion_changes(transaction: &Transaction, trigger_offset: usize) -> Vec<C
|
||||
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())
|
||||
|
Loading…
Reference in New Issue
Block a user