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

Can't exit path completion with no item match and even with a whitespace

Open rhcher opened this issue 10 months ago • 3 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

  1. touch test
  2. touch mini.lua
  3. nvim --clean -u mini.lua test
  4. input / trigger path completion, it's ok. then we input . but completion menu doesn't disappear.
Image
  1. and we input a whitespace, the menu finally disappear. but then we input d, the path completion triggered again.
Image

mini.lua

-- Run this file as `nvim --clean -u minimal.lua`

for name, url in pairs {
  -- ADD PLUGINS _NECESSARY_ TO REPRODUCE THE ISSUE, e.g:
  'https://github.com/Saghen/blink.cmp',
} do
  local install_path = vim.fn.fnamemodify('nvim_issue/' .. name, ':p')
  if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system { 'git', 'clone', '--depth=1', url, install_path }
  end
  vim.opt.runtimepath:append(install_path)
end

-- ADD INIT.LUA SETTINGS _NECESSARY_ FOR REPRODUCING THE ISSUE

require("blink.cmp").setup({
  keymap = {
    preset = "super-tab",
    ["Tab"] = { 'accept', 'fallback' },
    ["<C-y>"] = { 'accept', 'fallback' },
  },
  fuzzy = { prebuilt_binaries = { force_version = "v0.11.0" } },
})

Relevant configuration


neovim version

NVIM v0.11.0-dev-1664+ge71d2c817d Build type: Release LuaJIT 2.1.1736781742 Run "nvim -V1 -v" for more info

blink.cmp version

main

rhcher avatar Jan 31 '25 12:01 rhcher

We allow /. since this would mark the beginning of a hidden folder, and enables showing hidden folders, if they're disabled by default. However the /. b definitely seems odd. I've changed the behavior such that if the current path segment contains a space, we don't return any items, but previous path segments may contain spaces.

Allowed: ~/example foo/b Not allowed: ~/example foo

saghen avatar Feb 01 '25 20:02 saghen

Thanks for your great plugin and quick fix!

We allow /. since this would mark the beginning of a hidden folder, and enables showing hidden folders, if they're disabled by default.

This sounds reasonable, but I don't have a hidden directory or file in my root directory, and path source still brings up the completion menu, which doesn't seem to match my intuition.

rhcher avatar Feb 02 '25 17:02 rhcher

Good point, we should still match on the . but we don't have a great way to do this atm. Might need #657

saghen avatar Feb 02 '25 22:02 saghen