From 761fbc155a87d7c0af29b5ddea8d62f939f9b403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Mary=C5=84czak?= Date: Wed, 18 Feb 2026 22:13:38 +0100 Subject: [PATCH] test(lsp): add entire-line completion word case (#37927) Problem: Multiword completion items used to be cut at a first word. Solution: Add a test that ensures this does not regress in the future --- .../functional/plugin/lsp/completion_spec.lua | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/functional/plugin/lsp/completion_spec.lua b/test/functional/plugin/lsp/completion_spec.lua index b916c7a4bf..1ab22f89b9 100644 --- a/test/functional/plugin/lsp/completion_spec.lua +++ b/test/functional/plugin/lsp/completion_spec.lua @@ -503,6 +503,41 @@ describe('vim.lsp.completion: item conversion', function() eq(expected, result) end) + it('handles multiword testEdits', function() + local range0 = { + start = { line = 0, character = 0 }, + ['end'] = { line = 0, character = 0 }, + } + local items = { + { + detail = 'abc', + filterText = 'abc', + kind = 7, + label = 'abc', + sortText = 'abc', + textEdit = { + newText = 'abc: Abc', + range = range0, + }, + }, + } + local result = complete('|', items) + result = vim.tbl_map(function(x) + return { + abbr = x.abbr, + word = x.word, + } + end, result.items) + + local expected = { + { + abbr = 'abc', + word = 'abc: Abc', + }, + } + eq(expected, result) + end) + it('prefers wordlike components for snippets', function() -- There are two goals here: --