diff options
author | Maria José Solano <majosolano99@gmail.com> | 2024-02-26 11:42:51 -0800 |
---|---|---|
committer | Christian Clason <c.clason@uni-graz.at> | 2024-02-27 16:50:51 +0100 |
commit | 63f9c2da9aab52fa698fcbfdbc58ffd41794d28a (patch) | |
tree | 37742567d493c54245e6e0b1004f5d18b4319945 /test/functional/plugin/lsp/completion_spec.lua | |
parent | 3d96e3f9f25389e979bb7f2417ec2135f79fbfbb (diff) | |
download | rneovim-63f9c2da9aab52fa698fcbfdbc58ffd41794d28a.tar.gz rneovim-63f9c2da9aab52fa698fcbfdbc58ffd41794d28a.tar.bz2 rneovim-63f9c2da9aab52fa698fcbfdbc58ffd41794d28a.zip |
feat(lsp): support completion itemDefaults
Diffstat (limited to 'test/functional/plugin/lsp/completion_spec.lua')
-rw-r--r-- | test/functional/plugin/lsp/completion_spec.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp/completion_spec.lua b/test/functional/plugin/lsp/completion_spec.lua index b49f970385..655eb76be6 100644 --- a/test/functional/plugin/lsp/completion_spec.lua +++ b/test/functional/plugin/lsp/completion_spec.lua @@ -248,4 +248,32 @@ describe('vim.lsp._completion', function() item.user_data = nil eq(expected, item) end) + + it('uses defaults from itemDefaults', function() + --- @type lsp.CompletionList + 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', + textEditText = 'hello', + }, + }, + } + local result = complete('|', completion_list) + eq(1, #result.items) + local item = result.items[1].user_data.nvim.lsp.completion_item --- @type lsp.CompletionItem + eq(2, item.insertTextFormat) + eq('item-property-has-priority', item.data) + eq({ line = 1, character = 1 }, item.textEdit.range.start) + end) end) |