blink.cmp
blink.cmp copied to clipboard
Buffer words not initially available in buffers with an LSP
Make sure you have done the following
- [X] I have updated to the latest version of
blink.cmp
- [X] I have read the README
Bug Description
I am coming from using nvim-cmp + cmp-buffer today, so not sure if this is an intentional difference in the goal of this project.
When an LSP is attached to a buffer, Blink's autocomplete does not seem to match buffer words initially, and instead wants to use LSP recommendations (and friendly-snippets). Continuing autocomplete on a partial string will suggest buffer words. This is not a problem in new files
-- Buffer words in new file (working as expected)
- Open a new empty file
- Type a test string. Ex.
water
- Navigate to a different line
- Start typing the test string, Blink will suggest auto completing the string. Ex.
water
will be suggestion after the letterw
-- Buffer words in a file with LSP (not working as expected)
- Open a new file with an LSP started (I lazily start nvim-lspconfig on filetype). Ex.
nvim test.sh
- Type a test string. Ex.
water
- Navigate to a different line
- Start typing the test string, Blink will suggest LSP suggestions. Ex.
water
will not appear as a suggestion - Stop typing once string is partially entered. Ex.
wat
- Stop the autocomplete suggestions in one of these two ways: a. Use space to "leave" the partial string, and hit backspace back to incomplete word b. Hit escape to return to normal mode + A to return to insert mode at the end of incomplete word
- Continue to enter the next letters to finish string, Blink will suggest test string as an autocomplete option. Ex.
water
will be a suggestion after typinge
at the end ofwat
I tried playing with reordering the Sources thinking the sources might be processed in order or weighted, but this has no impact.
Relevant configuration
return {
'saghen/blink.cmp',
event = { "InsertEnter", "CmdLineEnter" },
dependencies = 'rafamadriz/friendly-snippets',
version = 'v0.*',
opts = {
-- 'default' for mappings similar to built-in completion
-- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate)
-- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept
-- see the "default configuration" section below for full documentation on how to define
-- your own keymap.
keymap = { preset = 'super-tab' },
appearance = {
-- Sets the fallback highlight groups to nvim-cmp's highlight groups
-- Useful for when your theme doesn't support blink.cmp
-- will be removed in a future release
use_nvim_cmp_as_default = true,
-- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- Adjusts spacing to ensure icons are aligned
nerd_font_variant = 'mono'
},
-- default list of enabled providers defined so that you can extend it
-- elsewhere in your config, without redefining it, via `opts_extend`
sources = {
default = { 'buffer', 'lsp', 'path', 'snippets' },
},
completion = {
menu = {
border = "single",
scrollbar = false,
},
documentation = {
auto_show = true,
window = {
border = "single",
},
},
},
signature = { enabled = true },
},
-- allows extending the providers array elsewhere in your config
-- without having to redefine it
opts_extend = { "sources.default" }
}
neovim version
NVIM v0.10.2
blink.cmp
version: branch, tag, or commit
v0.7.6, commit ae5a4ce