Skip to content

Commit a7e1acc

Browse files
committed
feat: don't search forward when guessing text edit
closes #58 This behavior wasn't obvious and wasn't consistent since it only applied to LSPs which didn't pass textEdits. This may be re-introduced behind a flag in the future
1 parent e695c79 commit a7e1acc

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

lua/blink/cmp/accept/text-edits.lua

+1-11
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,11 @@ function text_edits.guess_text_edit(bufnr, item)
5454
start_col = start_col - 1
5555
end
5656

57-
-- todo: optionally dont search forward since LSPs dont typically do this with textEdits
58-
-- so this will lead to inconsistent behavior
59-
-- OR add support on textEdits
60-
local end_col = current_col
61-
while end_col < #line do
62-
local char = line:sub(end_col + 1, end_col + 1)
63-
if char:match('[%w_\\-]') == nil then break end
64-
end_col = end_col + 1
65-
end
66-
6757
-- convert to 0-index
6858
return {
6959
range = {
7060
start = { line = current_line - 1, character = start_col - 1 },
71-
['end'] = { line = current_line - 1, character = end_col },
61+
['end'] = { line = current_line - 1, character = current_col },
7262
},
7363
newText = word,
7464
}

0 commit comments

Comments
 (0)