blink.cmp icon indicating copy to clipboard operation
blink.cmp copied to clipboard

Duplicate variable insertion with Erlang Language Platform (ELP) snippet completions

Open dandan-eg opened this issue 4 months ago • 2 comments

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

Image

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

dandan-eg avatar Aug 10 '25 14:08 dandan-eg

I notice I have the same duplication using erlang-ls which is another erlang LSP

dandan-eg avatar Aug 11 '25 20:08 dandan-eg

I was able to prevent this from happening by disabling the auto_brackets

completion = { accept = { auto_brackets = { enabled = false } } } 

guisaez avatar Oct 16 '25 12:10 guisaez