Bug: sources.providers.buffer.opts.get_bufnrs
cannot deal with multiple buffers
#433
Closed
2 tasks done
Labels
bug
Something isn't working
Make sure you have done the following
blink.cmp
Bug Description
When setting
sources.providers.buffer.opts.get_bufnrs
to something that returns multiple buffer numbers, you regularly get this error:failed to get completions with error: ...are/nvim/lazy/blink.cmp/lua/blink/cmp/sources/buffer.lua:18: attempt to index local 'line' (a nil value)
The issue seems to be caused by this:
blink.cmp/lua/blink/cmp/sources/buffer.lua
Lines 10 to 18 in 6e9fb62
I think the issue arises from
line_number
being the current line number of the current window where the cursor is (line 13), but then being used to indexlines
, which are the lines of any buffer passed (line 10). Thus, the error occurs when the cursor is currently on line n, while there is a different buffer passed byget_bufnrs
that has fewer than n lines. In this caseline[line_number]
is nil and consequently errors on line 18, explaining the error message.Relevant configuration
neovim version
NVIM v0.10.2
blink.cmp
version: branch, tag, or commit0.7.1
The text was updated successfully, but these errors were encountered: