Skip to content

Commit 655d2ee

Browse files
committed
fix: accept replacing first char in line
closes #38
1 parent 98575f0 commit 655d2ee

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

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

+5-6
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,14 @@ function text_edits.guess_text_edit(bufnr, item)
4949
-- Search forward/backward for the start/end of the word
5050
local start_col = current_col
5151
while start_col > 1 do
52-
local char = line:sub(start_col, start_col)
53-
if char:match('[%w_\\-]') == nil then
54-
start_col = start_col + 1
55-
break
56-
end
52+
local char = line:sub(start_col - 1, start_col - 1)
53+
if char:match('[%w_\\-]') == nil then break end
5754
start_col = start_col - 1
5855
end
5956

60-
-- todo: dont search forward since LSPs dont typically do this so it will be inconsistent
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
6160
local end_col = current_col
6261
while end_col < #line do
6362
local char = line:sub(end_col + 1, end_col + 1)

0 commit comments

Comments
 (0)