Skip to content

Commit 5b08b17

Browse files
committed
Auto merge of #17000 - mrnossiom:master, r=Veykril
fix: set the right postfix snippets competion source range Hi 👋, Changed the completion item `source_range` to match the replaced text. Though in VS Code it may not be disturbing because the snippet is previewed in a box, but in Helix editor, it's previewed by applying the main text edit. Before : ![image](https://github.com/rust-lang/rust-analyzer/assets/43814157/75960e02-64f0-4ecd-964f-7e1dd894c713) After : ![image](https://github.com/rust-lang/rust-analyzer/assets/43814157/84102f0e-9c81-4e7c-8ab5-a25986630e6f) Thanks
2 parents 0140272 + c5686c8 commit 5b08b17

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

crates/ide-completion/src/completions/postfix.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,7 @@ fn build_postfix_snippet_builder<'ctx>(
333333
) -> impl Fn(&str, &str, &str) -> Builder + 'ctx {
334334
move |label, detail, snippet| {
335335
let edit = TextEdit::replace(delete_range, snippet.to_owned());
336-
let mut item =
337-
CompletionItem::new(CompletionItemKind::Snippet, ctx.source_range(), label);
336+
let mut item = CompletionItem::new(CompletionItemKind::Snippet, delete_range, label);
338337
item.detail(detail).snippet_edit(cap, edit);
339338
let postfix_match = if ctx.original_token.text() == label {
340339
cov_mark::hit!(postfix_exact_match_is_high_priority);

0 commit comments

Comments
 (0)