fix(lsp): fix applying multiple out-of-range TextEdits (#17037)

This commit is contained in:
hrsh7th
2022-01-13 18:28:13 +09:00
committed by GitHub
parent f9b3b2dcfc
commit 43ef7df22d
2 changed files with 42 additions and 25 deletions

View File

@@ -1375,6 +1375,20 @@ describe('LSP', function()
'foobar';
}, buf_lines(1))
end)
it('applies multiple text edits at the end of the document', function()
local edits = {
make_edit(4, 0, 5, 0, "");
make_edit(5, 0, 5, 0, "foobar");
}
exec_lua('vim.lsp.util.apply_text_edits(...)', edits, 1)
eq({
'First line of text';
'Second line of text';
'Third line of text';
'Fourth line of text';
'foobar';
}, buf_lines(1))
end)
describe('cursor position', function()
it('don\'t fix the cursor if the range contains the cursor', function()