From 8d7eb03040c26e8e3bdbf51b25fe03a735b85b5b Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Fri, 21 Feb 2025 18:37:05 +0100 Subject: 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` --- test/functional/plugin/lsp/completion_spec.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') 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,12 +562,23 @@ 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 = { { abbr = 'copyOf(Collection coll) : List', word = 'copyOf', }, + { + abbr = 'for .. ipairs', + word = 'for .. ipairs', + }, { abbr = 'insert', word = 'insert', -- cgit