Skip to content

Commit 5bbf43b

Browse files
committed
lsp: fix TextEditAction handling
Fix TextEditAction handling when the text to be replaced is on a single line.
1 parent 8273d53 commit 5bbf43b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

autoload/go/lsp.vim

+3-3
Original file line numberDiff line numberDiff line change
@@ -1428,9 +1428,9 @@ function s:applyTextEdits(msg) abort
14281428
if l:msg.range.start.character > 0
14291429
let l:preSliceEnd = go#lsp#lsp#PositionOf(l:startcontent, l:msg.range.start.character-1) - 1
14301430
let l:startcontent = l:startcontent[:l:preSliceEnd]
1431-
elseif l:endline == l:startline && l:msg.range.end.character == 0
1432-
" l:startcontent should be the empty string when l:text is to be
1433-
" inserted at the beginning of the line.
1431+
elseif l:endline == l:startline && (l:msg.range.end.character == 0 || l:msg.range.start.character == 0)
1432+
" l:startcontent should be the empty string when l:text is a
1433+
" replacement at the beginning of the line.
14341434
let l:startcontent = ''
14351435
endif
14361436

0 commit comments

Comments
 (0)