Duplicate variable insertion with Erlang Language Platform (ELP) snippet completions
Make sure you have done the following
- [x] Updated to the latest version of
blink.cmp - [x] Searched for existing issues and documentation (try
<C-k>on https://cmp.saghen.dev)
Bug Description
I'm encountering a bug when using blink.cmp with the Erlang Language Platform (ELP) LSP server.
When I accept a function completion, the argument name is duplicated in the buffer.
For example, when completing link/1, the expected result is:
link(PidOrPid)
% ^cursor here
but instead i get
link(PidOrPid) PidOrPid
% ^cursor here
% press tab
% ^cursor here
Debug details
The LSP server returns the following snippet:
{
insertText: "link(${1:PidOrPort})",
insertTextFormat: 2,
label: "link/1"
}
To help debug, I temporaliy replaced the completion label with insertText using transform_items
transform_items = function(_, items)
for _, item in ipairs(items) do
if item.insertText and item.insertTextFormat == 2 then
item.label = item.insertText
end
end
return items
end,
This confirmed that the snippet is correct, but the argument is being inserted twice — once inside the parentheses, and again after the closing parenthesis.
Environment
Neovim: 0.11 Erlang Language Platform (ELP): latest Kickstart.nvim base config
Relevant configuration
{
snippets = { preset = 'luasnip' },
}
neovim version
v0.11.3
blink.cmp version
main
I notice I have the same duplication using erlang-ls which is another erlang LSP
I was able to prevent this from happening by disabling the auto_brackets
completion = { accept = { auto_brackets = { enabled = false } } }