mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Merge #8902
8902: fix: Fix code completion not inserting borrow text when client supports InsertAndReplace r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Tobias Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
eb08a27f1b
1 changed files with 6 additions and 3 deletions
|
@ -270,9 +270,12 @@ pub(crate) fn completion_item(
|
||||||
set_score(&mut lsp_item_with_ref, relevance);
|
set_score(&mut lsp_item_with_ref, relevance);
|
||||||
lsp_item_with_ref.label =
|
lsp_item_with_ref.label =
|
||||||
format!("&{}{}", mutability.as_keyword_for_ref(), lsp_item_with_ref.label);
|
format!("&{}{}", mutability.as_keyword_for_ref(), lsp_item_with_ref.label);
|
||||||
if let Some(lsp_types::CompletionTextEdit::Edit(it)) = &mut lsp_item_with_ref.text_edit
|
if let Some(it) = &mut lsp_item_with_ref.text_edit {
|
||||||
{
|
let new_text = match it {
|
||||||
it.new_text = format!("&{}{}", mutability.as_keyword_for_ref(), it.new_text);
|
lsp_types::CompletionTextEdit::Edit(it) => &mut it.new_text,
|
||||||
|
lsp_types::CompletionTextEdit::InsertAndReplace(it) => &mut it.new_text,
|
||||||
|
};
|
||||||
|
*new_text = format!("&{}{}", mutability.as_keyword_for_ref(), new_text);
|
||||||
}
|
}
|
||||||
vec![lsp_item_with_ref, lsp_item]
|
vec![lsp_item_with_ref, lsp_item]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue