aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChristian Clason <christian.clason@uni-due.de>2020-05-08 16:04:41 +0200
committerGitHub <noreply@github.com>2020-05-08 10:04:41 -0400
commit281e44f7bb24866d4a580d32aaeab8c8033f1fb0 (patch)
treea2fcc1ce784fdbe126ce57a24540a9cbef11f492 /test
parent9a67b030d9a054648296b45b615684dee768582d (diff)
downloadrneovim-281e44f7bb24866d4a580d32aaeab8c8033f1fb0.tar.gz
rneovim-281e44f7bb24866d4a580d32aaeab8c8033f1fb0.tar.bz2
rneovim-281e44f7bb24866d4a580d32aaeab8c8033f1fb0.zip
lsp: Make apply_text_edits non-ASCII safe (#12223)
* Make apply_text_edits non-ASCII safe Use `vim.str_byteindex` to correct starting and ending positions for text edits if the line contains non-ASCII characters. Fixes #12221 * text_edit may be applied to other buffers * make sure the buffer is loaded * add comments * add test for non-ASCII edits
Diffstat (limited to 'test')
-rw-r--r--test/functional/plugin/lsp_spec.lua9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index 372c6ef451..a263c6527d 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -779,7 +779,7 @@ describe('LSP', function()
Fourth line of text
å å ɧ 汉语 ↥ 🤦 🦄]]))
end)
- it('applies apply simple edits', function()
+ it('applies simple edits', function()
local edits = {
make_edit(0, 0, 0, 0, {"123"});
make_edit(1, 0, 1, 1, {"2"});
@@ -818,10 +818,9 @@ describe('LSP', function()
'å å ɧ 汉语 ↥ 🤦 🦄';
}, buf_lines(1))
end)
- pending('applies non-ASCII characters edits', function()
- -- FIXME: We don't handle non-ASCII characters well in UTF-16
+ it('applies non-ASCII characters edits', function()
local edits = {
- make_edit(4, 0, 4, 14, {"a a h"});
+ make_edit(4, 3, 4, 4, {"ä"});
}
exec_lua('vim.lsp.util.apply_text_edits(...)', edits, 1)
eq({
@@ -829,7 +828,7 @@ describe('LSP', function()
'Second line of text';
'Third line of text';
'Fourth line of text';
- 'a a h';
+ 'å ä ɧ 汉语 ↥ 🤦 🦄';
}, buf_lines(1))
end)
end)