aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHirokazu Hata <h.hata.ai.t@gmail.com>2020-05-04 09:05:16 +0900
committerHirokazu Hata <h.hata.ai.t@gmail.com>2020-05-04 09:05:16 +0900
commit67634da71403737bd3f0c4c037b9ccf3382903ae (patch)
treeef48116d589aad57788062d162cc0114c8163715
parent0107a194fa6a82c3d919af2e2b606eeb74bc2352 (diff)
downloadrneovim-67634da71403737bd3f0c4c037b9ccf3382903ae.tar.gz
rneovim-67634da71403737bd3f0c4c037b9ccf3382903ae.tar.bz2
rneovim-67634da71403737bd3f0c4c037b9ccf3382903ae.zip
lsp: add a lsp.util.apply_text_edits test(pending)
We don't handle non-ASCII characters well in UTF-16. So I add a non-ASCII characters test case.
-rw-r--r--test/functional/plugin/lsp_spec.lua21
1 files changed, 19 insertions, 2 deletions
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index 94e85d6fe6..63188a9b09 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -770,13 +770,14 @@ describe('LSP', function()
exec_lua([[require'vim.lsp'; return vim.fn.getcompletion('Lsp', 'highlight')]]))
end)
- describe('apply_edits', function()
+ describe('apply_text_edits', function()
before_each(function()
insert(dedent([[
First line of text
Second line of text
Third line of text
- Fourth line of text]]))
+ Fourth line of text
+ å å ɧ 汉语 ↥ 🤦 🦄]]))
end)
it('applies apply simple edits', function()
local edits = {
@@ -790,6 +791,7 @@ describe('LSP', function()
'2econd line of text';
'3ird line of text';
'Fourth line of text';
+ 'å å ɧ 汉语 ↥ 🤦 🦄';
}, buf_lines(1))
end)
it('applies complex edits', function()
@@ -813,6 +815,21 @@ describe('LSP', function()
'The next line of text';
'another line of text';
'before this!';
+ 'å å ɧ 汉语 ↥ 🤦 🦄';
+ }, buf_lines(1))
+ end)
+ pending('applies non-ASCII characters edits', function()
+ -- FIXME: We don't handle non-ASCII characters well in UTF-16
+ local edits = {
+ make_edit(4, 0, 4, 14, {"a a h"});
+ }
+ 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';
+ 'a a h';
}, buf_lines(1))
end)
end)