Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra character inserted during some completions #1281

Closed
2 tasks done
rliebz opened this issue Feb 20, 2025 · 2 comments
Closed
2 tasks done

Extra character inserted during some completions #1281

rliebz opened this issue Feb 20, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@rliebz
Copy link

rliebz commented Feb 20, 2025

Make sure you have done the following

  • Updated to the latest version of blink.cmp
  • Searched for existing issues and documentation (try <C-k> on https://cmp.saghen.dev)

Bug Description

Reproduction:

  1. Open a lua file, such as repro.lua
  2. On a new line, type ---@diagnostic d
  3. Wait for the completion window to pop up
  4. Press either <c-y> to accept or <c-n> to navigate to the next option
  5. Notice that the d character appears at the end of the completion, after the cursor

A few other things I've noticed:

  • This doesn't happen when completing ---@diagnostic, but it will happen when completing disable-next-line or missing-fields (as in, ---@diagnostic disable-next-line: missing-fields).
  • It is always the last character that is inserted at the end, so if I type ---@diagnostic di, an i will be inserted at the end, or if I type dis, it will be an s.

Config:

-- Run with `nvim -u repro.lua`

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

---@diagnostic disable-next-line: missing-fields
require("lazy.minit").repro({
	spec = {
		{
			"saghen/blink.cmp",
			-- please test on `main` if possible
			-- otherwise, remove this line and set `version = '*'`
			-- build = "cargo build --release",
			version = "*",
			opts = {
				sources = {
					default = {
						"lsp",
					},
				},
			},
		},
		{
			"neovim/nvim-lspconfig",
			opts = {
				servers = {
					lua_ls = {},
				},
			},
			config = function(_, opts)
				local lspconfig = require("lspconfig")
				for server, config in pairs(opts.servers) do
					-- passing config.capabilities to blink.cmp merges with the capabilities in your
					-- `opts[server].capabilities, if you've defined it
					config.capabilities = require("blink.cmp").get_lsp_capabilities()
					lspconfig[server].setup(config)
				end
			end,
		},
	},
})

Relevant configuration

sources = {
  default = { "lsp" },
}

neovim version

NVIM v0.10.3 Build type: Release LuaJIT 2.1.1734355927

blink.cmp version

v0.12.4

@rliebz rliebz added the bug Something isn't working label Feb 20, 2025
@Saghen Saghen closed this as completed Feb 20, 2025
@tknightz
Copy link

I ran into the same issue with tailwind-css-language, looks like it's caused by this commit: ceb9f91. Rolling back to the previous commit fixed it.

Saghen added a commit that referenced this issue Feb 21, 2025
@Saghen
Copy link
Owner

Saghen commented Feb 21, 2025

@tknightz Should be fixed on that commit but I haven't tested. You ran into a slightly different issue than this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants