Skip to content

Commit c5686c8

Browse files
committed
fix: set the right postfix snippets competion source range
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.
1 parent c3b8c2a commit c5686c8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

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

Lines changed: 1 addition & 2 deletions
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)