diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-20 22:23:20 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-20 22:23:20 +0100 |
commit | eb08a27f1bd31cc15db4893dded60663effaf3f9 (patch) | |
tree | b0cbecf0f4fa7cacfe5faf1a761bcb6072873a8f | |
parent | 8d713b3e462ce1ff5bdeebc5f2bb6f90310c69ac (diff) | |
parent | 6b0ac95df1be5a6423d4141710100f01b3f84b48 (diff) |
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 <[email protected]>
-rw-r--r-- | crates/rust-analyzer/src/to_proto.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index ef9e0aee9..0a3a56773 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -270,9 +270,12 @@ pub(crate) fn completion_item( | |||
270 | set_score(&mut lsp_item_with_ref, relevance); | 270 | set_score(&mut lsp_item_with_ref, relevance); |
271 | lsp_item_with_ref.label = | 271 | lsp_item_with_ref.label = |
272 | format!("&{}{}", mutability.as_keyword_for_ref(), lsp_item_with_ref.label); | 272 | format!("&{}{}", mutability.as_keyword_for_ref(), lsp_item_with_ref.label); |
273 | if let Some(lsp_types::CompletionTextEdit::Edit(it)) = &mut lsp_item_with_ref.text_edit | 273 | if let Some(it) = &mut lsp_item_with_ref.text_edit { |
274 | { | 274 | let new_text = match it { |
275 | it.new_text = format!("&{}{}", mutability.as_keyword_for_ref(), it.new_text); | 275 | lsp_types::CompletionTextEdit::Edit(it) => &mut it.new_text, |
276 | lsp_types::CompletionTextEdit::InsertAndReplace(it) => &mut it.new_text, | ||
277 | }; | ||
278 | *new_text = format!("&{}{}", mutability.as_keyword_for_ref(), new_text); | ||
276 | } | 279 | } |
277 | vec![lsp_item_with_ref, lsp_item] | 280 | vec![lsp_item_with_ref, lsp_item] |
278 | } | 281 | } |