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

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

Open
2 tasks done
rhcher opened this issue Jan 31, 2025 · 3 comments
Open
2 tasks done
Labels
bug Something isn't working sources Specific source provider or the system as a whole

Comments

@rhcher
Copy link

rhcher commented Jan 31, 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

  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 rhcher added the bug Something isn't working label Jan 31, 2025
@Saghen Saghen closed this as completed in 0abe117 Feb 1, 2025
@Saghen
Copy link
Owner

Saghen commented Feb 1, 2025

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 Saghen added the sources Specific source provider or the system as a whole label Feb 1, 2025
@rhcher
Copy link
Author

rhcher commented Feb 2, 2025

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.

@Saghen Saghen reopened this Feb 2, 2025
@Saghen
Copy link
Owner

Saghen commented Feb 2, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sources Specific source provider or the system as a whole
Projects
None yet
Development

No branches or pull requests

2 participants