diff options
author | Sebastian Lyng Johansen <sebastian@lyngjohansen.com> | 2024-07-02 18:27:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-02 18:27:51 +0200 |
commit | aec7f1979ada1b34cfb3d8fd33769232d0323ea8 (patch) | |
tree | 5004c5ee5ee32617ade3206171088cb14ecffbcd /test/functional/plugin/lsp/completion_spec.lua | |
parent | cb84cd5d9fbae40313f4fb9fd8bf715511c9ca28 (diff) | |
download | rneovim-aec7f1979ada1b34cfb3d8fd33769232d0323ea8.tar.gz rneovim-aec7f1979ada1b34cfb3d8fd33769232d0323ea8.tar.bz2 rneovim-aec7f1979ada1b34cfb3d8fd33769232d0323ea8.zip |
fix(lsp): fallback to `label` for completion items if all others are missing (#29522)
Diffstat (limited to 'test/functional/plugin/lsp/completion_spec.lua')
-rw-r--r-- | test/functional/plugin/lsp/completion_spec.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp/completion_spec.lua b/test/functional/plugin/lsp/completion_spec.lua index bc10c0c937..5c2933c610 100644 --- a/test/functional/plugin/lsp/completion_spec.lua +++ b/test/functional/plugin/lsp/completion_spec.lua @@ -427,6 +427,33 @@ describe('vim.lsp.completion: item conversion', function() eq('the-insertText', text) end ) + + it( + 'defaults to label as textEdit.newText if insertText or textEditText are not present', + function() + local completion_list = { + isIncomplete = false, + itemDefaults = { + editRange = { + start = { line = 1, character = 1 }, + ['end'] = { line = 1, character = 4 }, + }, + insertTextFormat = 2, + data = 'foobar', + }, + items = { + { + label = 'hello', + data = 'item-property-has-priority', + }, + }, + } + local result = complete('|', completion_list) + eq(1, #result.items) + local text = result.items[1].user_data.nvim.lsp.completion_item.textEdit.newText + eq('hello', text) + end + ) end) describe('vim.lsp.completion: protocol', function() |