-
Notifications
You must be signed in to change notification settings - Fork 155
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
Path suggestions missing when cursor is followed by any other character #959
Comments
Trying this out a bit more, today I noticed something rather strange. It turns out, this only happens on Screen.Recording.2025-01-10.at.17.21.08.movFor context, this is how it used to behave with Screen.Recording.2025-01-10.at.17.24.11.movHow my return {
'hrsh7th/nvim-cmp',
event = 'VeryLazy',
dependencies = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-cmdline',
'hrsh7th/cmp-calc',
'hrsh7th/cmp-emoji',
'garymjr/nvim-snippets',
},
config = function()
local cmp = require('cmp')
local lspkind = require('lspkind')
local cmp_select_opts = {behavior = cmp.SelectBehavior.Select}
cmp.setup({
snippet = {
expand = function(args)
vim.snippet.expand(args.body)
end,
},
preselect = cmp.PreselectMode.None,
completion = {
completeopt = 'menu,menuone,noinsert,noselect',
},
mapping = {
['<CR>'] = cmp.mapping.confirm({select = false, behavior = cmp.ConfirmBehavior.Insert}),
['<C-e>'] = cmp.mapping.abort(),
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-d>'] = cmp.mapping.scroll_docs(4),
['<Up>'] = cmp.mapping.select_prev_item(cmp_select_opts),
['<Down>'] = cmp.mapping.select_next_item(cmp_select_opts),
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select_opts),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select_opts),
['<C-y>'] = cmp.mapping.complete(),
},
sources = cmp.config.sources({
{name = 'lazydev', group_index = 0},
{name = 'nvim_lsp', keyword_length = 1},
{
name = 'snippets',
entry_filter = function()
local ctx = require('cmp.config.context')
local in_string = ctx.in_syntax_group('String') or ctx.in_treesitter_capture('string')
local in_comment = ctx.in_syntax_group('Comment') or ctx.in_treesitter_capture('comment')
return not in_string and not in_comment
end,
},
}, {
{name = 'buffer', keyword_length = 3},
{name = 'emoji'},
{name = 'calc'},
{name = 'path'},
}),
formatting = {
---@type fun(entry: cmp.Entry, vim_item: vim.CompletedItem): vim.CompletedItem
format = lspkind.cmp_format({
mode = 'symbol_text',
}),
---@type cmp.ItemField[]
fields = {'abbr', 'kind'}, -- Remove 'menu' to avoid truncation
},
})
cmp.setup.cmdline({'/', '?'}, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{name = 'buffer'},
},
})
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{name = 'path'},
}, {
{name = 'cmdline'},
}),
})
end,
} |
Trying out different configurations sets, I managed to find something that seems to help with this. If I set Screen.Recording.2025-01-12.at.13.07.32.movIs this desirable tho? I'd like to keep |
Make sure you have done the following
blink.cmp
<C-k>
on https://cmp.saghen.dev)Bug Description
This has been partially discussed in this discussion. Head over there for more context.
Problem
When triggering completion on a path, no suggestion will be given if the any character comes after the cursor.
Moreover, as mentioned in that discussion by @Saghen, it might be worth adding
path
as one of the fallbacks for thelsp
source, although that sadly doesn't seem to solve this problem.Demo
blink.cmp
Screen.Recording.2025-01-08.at.09.48.08.mov
To make it more clear:
Here,
/
can be anything. If I have ar
,u
, or any character, it won't even suggest things.nvim-cmp
Screen.Recording.2025-01-08.at.09.46.29.mov
Relevant configuration
neovim
versionv0.10.3
blink.cmp
version0.10.0
The text was updated successfully, but these errors were encountered: