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

Path source should show when only enabled provider

Open jemag opened this issue 1 year ago • 4 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

The following keymap will work with most default sources, but not the path one

    ['<C-b>'] = { function(cmp) cmp.show({ providers = { 'path' } }) end },

I am guessing this might be related to the trigger characters that the path provider possesses.

However, in that case, since we are doing an explicit manual trigger of the provider, this should work and not be reliant on any trigger character.

Relevant configuration

require("blink-cmp").setup({
  keymap = {
    ['<C-b>'] = { function(cmp) cmp.show({ providers = { 'path' } }) end },
  },
  completion = {
    documentation = {
      -- Controls whether the documentation window will automatically show when selecting a completion item
      auto_show = true,
      auto_show_delay_ms = 500,
      update_delay_ms = 50,
    },
  },
  sources = {
    -- add lazydev to your completion providers
    default = { "lazydev", "lsp", "path", "snippets", "buffer" },
  },
})

neovim version

NVIM v0.11.0-dev-1471+g64b0e6582a

blink.cmp version

0.10.0

jemag avatar Jan 09 '25 00:01 jemag

It seems to work, perhaps you're confusing path completions from your LSP with the path source? Or perhaps you're expecting the path completions to show up in a situation that they currently don't (i.e. src/|)? Closing for now since it seems to be working as intended but I'll re-open if you can provide a bit more clarity

saghen avatar Jan 13 '25 03:01 saghen

@Saghen In your case, does it work even without any trigger character specified?

If I have the following: Where cursor is at {CURSOR_POSITION}

  test = "./{CURSOR_POSITION}"

Then yes it will work because the trigger characters are present before hand.

however, the following:

test = "{CURSOR_POSITION}"

does not work for me. The completion popup will not show.


Basically, what I am looking for is to trigger path completion of the current file directory without having to type ./ for the current directory.

Perhaps there is a better way to go about this, but I was expecting it to work if summoned without any trigger character (i.e.: it would default to the current dir).

jemag avatar Jan 13 '25 04:01 jemag

I get what you mean now, thanks!

Note to self: Provide the enabled providers as a list in the context?

saghen avatar Jan 13 '25 04:01 saghen

ran into this issue today as well. It's worth mentioning that I can use <c-x><c-f>(:h i_CTRL-X_CTRL-F) to bring up the path pmenu without it starting with / or ./. But blink path completion doesn't work.

I also tried this but it doesn't work

opts.keymap["<C-x><C-f>"] = { function(cmp) cmp.show({ providers = { "path" } }) end }

jackielii avatar May 08 '25 14:05 jackielii