diff options
author | Lukas Wirth <[email protected]> | 2021-04-08 13:22:54 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-04-08 14:21:27 +0100 |
commit | 8fa3011908e3b6cc74cfa4d7e896f5d329e4228c (patch) | |
tree | 9c6f1e2a87d045a2cd65c9f9597f0b7285d0303b /crates/rust-analyzer/src/handlers.rs | |
parent | 3191a93185b34c6deebca2aad0584d2840ad6d43 (diff) |
Use CompletionTextEdit::InsertAndReplace if supported by the client
Diffstat (limited to 'crates/rust-analyzer/src/handlers.rs')
-rw-r--r-- | crates/rust-analyzer/src/handlers.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 31d8c487b..edfa42eb5 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -664,10 +664,13 @@ pub(crate) fn handle_completion( | |||
664 | }; | 664 | }; |
665 | let line_index = snap.file_line_index(position.file_id)?; | 665 | let line_index = snap.file_line_index(position.file_id)?; |
666 | 666 | ||
667 | let insert_replace_support = | ||
668 | snap.config.insert_replace_support().then(|| text_document_position.position); | ||
667 | let items: Vec<CompletionItem> = items | 669 | let items: Vec<CompletionItem> = items |
668 | .into_iter() | 670 | .into_iter() |
669 | .flat_map(|item| { | 671 | .flat_map(|item| { |
670 | let mut new_completion_items = to_proto::completion_item(&line_index, item.clone()); | 672 | let mut new_completion_items = |
673 | to_proto::completion_item(insert_replace_support, &line_index, item.clone()); | ||
671 | 674 | ||
672 | if completion_config.enable_imports_on_the_fly { | 675 | if completion_config.enable_imports_on_the_fly { |
673 | for new_item in &mut new_completion_items { | 676 | for new_item in &mut new_completion_items { |