kickstart.nvim icon indicating copy to clipboard operation
kickstart.nvim copied to clipboard

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

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

I'm using Kickstart.nvim with the default blink.cmp setup and the Erlang Language Platform (ELP) LSP server. When accepting a function completion, the argument name is duplicated in the buffer.

Example:

Image

Completing link/1 results in:

% Expected:
link(PidOrPort)

% Got:
link(PidOrPort) PidOrPort

Debug info:

The LSP server returns a valid snippet:

{
  "label": "link/1",
  "insertText": "link(${1:PidOrPort})",
  "insertTextFormat": 2
}

I used transform_items in blink.cmp to confirm this:


sources = {
  default = { 'lsp', 'path', 'snippets', 'lazydev' },
  providers = {
    lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
  },
  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 confirms the snippet is correct by changing the completion label with the snippet, but the argument is inserted twice. It seems to be a bug in how blink.cmp handles snippet expansion, possibly in combination with Kickstart’s default config.

Versions:

Ubuntu 22.04.5 LTS NVIM v0.11.3 elp-linux-x86_64-unknown-linux-gnu-otp-27.3

Steps to reproduce:

-Create a hello.erl file -Add an Erlang module:

-module(hello).

start() -> % <- cursor here

-Ensure the ELP LSP server is running -Start typing "link" and accept the completion "link/1" (C-y by default)

dandan-eg avatar Aug 10 '25 16: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