clangd not hiding suggestions after comma or space
McArdellje opened this issue · 3 comments
Checkhealth
Put result of :checkhealth compe
.
## compe:snippet
- OK: snippet engine detected.
## compe:mapping
- INFO: `compe#complete` is not mapped
- OK: `compe#confirm` is mapped: (`i <CR> vsnip#available(1) ? '<Plug>(vsnip-expand-or-jump)' : compe#confirm("<CR>")`)
- INFO: `compe#close` is not mapped
- INFO: `compe#scroll` is not mapped
Describe the bug
while using the clangd server from lspconfig comma and space don't hide the autocomplete suggestions, they only filter it to only show functionf
To Reproduce
Steps to reproduce the behavior with the minimal config:
add Plug 'neovim/nvim-lspconfig'
to the plug section of the minimal.vim
add this to the end of the minimal.vim
lua<<EOF
require'lspconfig'.clangd.setup {}
vim.o.completeopt = "menuone,noselect"
require'compe'.setup {
enabled = true;
autocomplete = true;
debug = false;
min_length = 1;
preselect = 'enable';
throttle_time = 80;
source_timeout = 200;
incomplete_delay = 400;
max_abbr_width = 100;
max_kind_width = 100;
max_menu_width = 100;
documentation = true;
source = {
path = false;
buffer = false;
calc = true;
nvim_lsp = true;
nvim_lua = true;
vsnip = true;
ultisnips = false;
};
}
EOF
Actual behavior
typing a comma or space during autocomplete filters suggestions to only show functions
Expected behavior
typing a comma or space stops autocomplete
Screenshots (optional)
clangd_autocomplete_issue.mp4
Additional context (optional)
cland version 12.0.1
I have the same problem with clangd.
function! CloseComplete() abort
if mode()[0] ==# 'i' && pumvisible()
return ",\<C-r>=luaeval('require\"compe\"._close()')\<CR>"
endif
return ","
endfunction
imap <silent> <expr> , CloseComplete()
I use this script in ftplugin/cpp.vim as a tempoary solution. This function is inspired by compe#close
.
It seems that clangd still offers suggestions when (
, ,
(or other characters) are typed. But other language server dose not (test on lua and python). Other completion plugs like coc and vscode's completion work with clangd well. Maybe there are addtional checks for these characters.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.