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.
This commit is contained in:
Milo Moisson 2024-04-02 13:35:12 +02:00
parent c3b8c2a254
commit c5686c8941
No known key found for this signature in database
GPG Key ID: 7EA9B7563C01CA5E

View File

@ -333,8 +333,7 @@ fn build<'ctx>(
) -> impl Fn(&str, &str, &str) -> Builder + 'ctx {
move |label, detail, snippet| {
let edit = TextEdit::replace(delete_range, snippet.to_owned());
let mut item =
CompletionItem::new(CompletionItemKind::Snippet, ctx.source_range(), label);
let mut item = CompletionItem::new(CompletionItemKind::Snippet, delete_range, label);
item.detail(detail).snippet_edit(cap, edit);
let postfix_match = if ctx.original_token.text() == label {
cov_mark::hit!(postfix_exact_match_is_high_priority);