mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
feat(lsp): support completion itemDefaults
This commit is contained in:
committed by
Christian Clason
parent
3d96e3f9f2
commit
63f9c2da9a
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user