mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +00:00
fix(lsp): start incremental sync range at previous newline character (#17610)
This change forces the start of an incremental sync range to begin always on an existing line.
This commit is contained in:
committed by
GitHub
parent
228ea78622
commit
a5e475fcc2
@@ -207,16 +207,16 @@ describe('incremental synchronization', function()
|
||||
{
|
||||
range = {
|
||||
['start'] = {
|
||||
character = 0,
|
||||
line = 1
|
||||
character = 11,
|
||||
line = 0,
|
||||
},
|
||||
['end'] = {
|
||||
character = 0,
|
||||
line = 1
|
||||
}
|
||||
},
|
||||
rangeLength = 0,
|
||||
text = 'hello world\n'
|
||||
rangeLength = 1,
|
||||
text = '\nhello world\n'
|
||||
}
|
||||
}
|
||||
test_edit({"hello world"}, {"yyp"}, expected_text_changes, 'utf-16', '\n')
|
||||
@@ -226,20 +226,39 @@ describe('incremental synchronization', function()
|
||||
{
|
||||
range = {
|
||||
['start'] = {
|
||||
character = 0,
|
||||
line = 1
|
||||
character = 11,
|
||||
line = 0
|
||||
},
|
||||
['end'] = {
|
||||
character = 0,
|
||||
line = 1
|
||||
}
|
||||
},
|
||||
rangeLength = 0,
|
||||
text = '\n'
|
||||
rangeLength = 1,
|
||||
text = '\n\n'
|
||||
}
|
||||
}
|
||||
test_edit({"hello world"}, {"o"}, expected_text_changes, 'utf-16', '\n')
|
||||
end)
|
||||
it('adding a line to an empty buffer', function()
|
||||
local expected_text_changes = {
|
||||
{
|
||||
range = {
|
||||
['start'] = {
|
||||
character = 0,
|
||||
line = 0
|
||||
},
|
||||
['end'] = {
|
||||
character = 0,
|
||||
line = 1
|
||||
}
|
||||
},
|
||||
rangeLength = 1,
|
||||
text = '\n\n'
|
||||
}
|
||||
}
|
||||
test_edit({""}, {"o"}, expected_text_changes, 'utf-16', '\n')
|
||||
end)
|
||||
end)
|
||||
describe('multi line edit', function()
|
||||
it('deletion and insertion', function()
|
||||
|
||||
Reference in New Issue
Block a user