buffer source stops working in cmdline
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
I have the following config.
cmdline = {
sources = function()
local type = vim.fn.getcmdtype()
-- Search forward and backward
if type == '/' or type == '?' then return { 'buffer' } end
-- Command line
if type == ':' then return { 'cmdline', 'buffer' } end
-- Input (vim.fn.input())
if type == '@' then return { 'buffer' } end
return {}
end,
...
}
the buffer source used to work perfectly in the cmdline mode, regardless of what command it is.
after https://github.com/saghen/blink.cmp/pull/1734, now buffer source only works for :s/:g and there is no way to make it work for other command.
cc @soifou
Relevant configuration
neovim version
NVIM v0.11.5
blink.cmp version
1.7.0
Thanks, you pointed out a problem.
For your issue, using the latest version, I suggest you remove cmdline.sources and add sources.providers.buffer.enabled = true.
Hmm reverted, actually I might investigate this more deeply.
thanks for the reply. The issue is here. Now I have patched this function to workaround this issue.
With the new logic, we only enable the buffer source where it makes sense (searching, substitution, input). What use case do you have to enable the buffer source globally in the cmdline?
@saghen That's a good question I should have asked it earlier but the underlying issue is that enabled can't seem to be overriden by user config. If they want to enable the buffer source while in : so be it, set enabled = true should work (think this is because of call_or_get logic).
@saghen e.g., when I do vimgrep or G commit -m "..." (G is a git wrapper), I'd like to complete words from the buffers.
@soifou do you mean providers.buffer.enabled = true? this still doesn't work unfortunately.
if we don't want to enable it globally, we can also make the list of commands configurable.
Pushed an update, grep commands come definitively into that list. I'm not sure though if we want to handle plugins commands like G commit -m.
do you mean providers.buffer.enabled = true? this still doesn't work unfortunately.
Yeah that was I meant in my previous comment, this should work but currently it's not :) I add that to my list.
@soifou can we make it configurable? I have a few other self-defined commands that need the buffer source.
@raulchen on main you can now remove your cmdline.sources and add sources.providers.buffer.enabled = true to workaround this. The buffer source will be always enabled. Or you can tweak it in a function if you need more control.
can we make it configurable?
Make sense, I'll put this on my todo!