aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/plugin/lsp/completion_spec.lua21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/functional/plugin/lsp/completion_spec.lua b/test/functional/plugin/lsp/completion_spec.lua
index aad7e350ee..766dd16541 100644
--- a/test/functional/plugin/lsp/completion_spec.lua
+++ b/test/functional/plugin/lsp/completion_spec.lua
@@ -495,7 +495,9 @@ describe('vim.lsp.completion: protocol', function()
bufnr = vim.api.nvim_get_current_buf()
vim.api.nvim_win_set_buf(0, bufnr)
return vim.lsp.start({ name = 'dummy', cmd = server.cmd, on_attach = function(client, bufnr)
- vim.lsp.completion.enable(true, client.id, bufnr)
+ vim.lsp.completion.enable(true, client.id, bufnr, { convert = function(item)
+ return { abbr = item.label:gsub('%b()', '')}
+ end})
end})
]],
completion_result
@@ -700,4 +702,21 @@ describe('vim.lsp.completion: protocol', function()
eq(true, exec_lua('return _G.called'))
end)
end)
+
+ it('custom word/abbar format', function()
+ create_server({
+ isIncomplete = false,
+ items = {
+ {
+ label = 'foo(bar)',
+ },
+ },
+ })
+
+ feed('ifo')
+ trigger_at_pos({ 1, 1 })
+ assert_matches(function(matches)
+ eq('foo', matches[1].abbr)
+ end)
+ end)
end)