|
|
@ -178,17 +178,21 @@ impl Completion {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// apply additional edits, mostly used to auto import unqualified types
|
|
|
|
// 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
|
|
|
|
None
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Self::resolve_completion_item(doc, item.clone())
|
|
|
|
Self::resolve_completion_item(doc, item.clone())
|
|
|
|
.and_then(|item| item.additional_text_edits)
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if let Some(additional_edits) = item
|
|
|
|
if let Some(additional_edits) = resolved_item
|
|
|
|
.additional_text_edits
|
|
|
|
|
|
|
|
.as_ref()
|
|
|
|
.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() {
|
|
|
|
if !additional_edits.is_empty() {
|
|
|
|
let transaction = util::generate_transaction_from_edits(
|
|
|
|
let transaction = util::generate_transaction_from_edits(
|
|
|
|