diff options
author | Mathias Fussenegger <f.mathias@zignar.net> | 2025-02-21 18:37:05 +0100 |
---|---|---|
committer | Mathias Fußenegger <mfussenegger@users.noreply.github.com> | 2025-02-22 09:33:54 +0100 |
commit | 8d7eb03040c26e8e3bdbf51b25fe03a735b85b5b (patch) | |
tree | 14b8d70d8b0b185838848f738e735e52eb4bc527 /test | |
parent | db2c3d1143fb5888602a2cee84578bd8a9c88bd7 (diff) | |
download | rneovim-8d7eb03040c26e8e3bdbf51b25fe03a735b85b5b.tar.gz rneovim-8d7eb03040c26e8e3bdbf51b25fe03a735b85b5b.tar.bz2 rneovim-8d7eb03040c26e8e3bdbf51b25fe03a735b85b5b.zip |
fix(lsp): unify get_completion_word for textEdits/insertText
Problem:
After https://github.com/neovim/neovim/pull/32377 selecting snippets
provided by luals inserted the multi-line text before accepting the
candidates. That's inconsistent with servers who provide `textEdit`
instead of `insertText` and having lines shift up/down while cycling
through the completion candidates is a bit irritating.
Solution:
Use the logic used for `textEdit` snippets also for `insertText`
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/plugin/lsp/completion_spec.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp/completion_spec.lua b/test/functional/plugin/lsp/completion_spec.lua index d101e68273..c5fa411efe 100644 --- a/test/functional/plugin/lsp/completion_spec.lua +++ b/test/functional/plugin/lsp/completion_spec.lua @@ -562,6 +562,13 @@ describe('vim.lsp.completion: item conversion', function() range = range0, }, }, + -- luals for snippet + { + insertText = 'for ${1:index}, ${2:value} in ipairs(${3:t}) do\n\t$0\nend', + insertTextFormat = 2, + kind = 15, + label = 'for .. ipairs', + }, } local expected = { { @@ -569,6 +576,10 @@ describe('vim.lsp.completion: item conversion', function() word = 'copyOf', }, { + abbr = 'for .. ipairs', + word = 'for .. ipairs', + }, + { abbr = 'insert', word = 'insert', }, |