coc.nvim icon indicating copy to clipboard operation
coc.nvim copied to clipboard

Cannot close completion after input a space for clangd

Open A4-Tacks opened this issue 2 months ago • 4 comments

Result from CocInfo

## versions

vim version: VIM - Vi IMproved 9.1 9011734
node version: v23.9.0
coc.nvim version: 0.0.82-5552eb7 2025-09-20 11:57:09 +0800
coc.nvim directory: /home/lrne/.vim/plugged/coc.nvim
term: dumb
platform: linux

## Log of coc.nvim

2025-10-23T15:59:52.632 INFO (pid:6329) [plugin] - coc.nvim initialized with node: v23.9.0 after 547
2025-10-23T15:59:52.646 INFO (pid:6329) [services] - LanguageClient clangd state change: stopped => starting
2025-10-23T15:59:52.658 INFO (pid:6329) [language-client-index] - Language server "clangd" started with 6353
2025-10-23T15:59:52.730 INFO (pid:6329) [services] - LanguageClient clangd state change: starting => running
2025-10-23T15:59:52.743 INFO (pid:6329) [services] - service clangd started
2025-10-23T15:59:56.621 INFO (pid:6329) [attach] - Request action: stopCompletion [ '' ]
2025-10-23T15:59:58.099 INFO (pid:6329) [attach] - receive notification: showInfo []

Describe the bug

The space after input the structure name does not close the completion list

Reproduce the bug

We will close your issue when you don't provide minimal vimrc and we can't reproduce it

  • Create file mini.vim with:

    colorscheme habamax
    
    set nu
    set laststatus=2
    set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
    set statusline^=%(%1*[%{coc#status()}%{get(b:,'coc_current_function','')}]%*\ %)
    
    call plug#begin('~/.vim/plugged')
    Plug 'neoclide/coc.nvim'
    call plug#end()
    
    inoremap <silent><expr> <cr>
                \   coc#pum#visible() ? coc#pum#confirm()
                \ : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
    inoremap <silent><expr> <tab> coc#pum#visible()
                \   ? coc#pum#next(0)
                \   : coc#refresh()
    nmap <F3> <Plug>(coc-codeaction-cursor)
    xmap <F3> <Plug>(coc-codeaction-selected)
    nmap <C-k> <Plug>(coc-diagnostic-prev)
    nmap <C-j> <Plug>(coc-diagnostic-next)
    
    augroup coc_user
      autocmd!
      " Update statusline
      autocmd User CocStatusChange redrawstatus
    augroup end
    
  • Start vim with command: vim -Nu mini.vim foo.c

  • Operate vim.

    1. Input struct foo {

    Expect completion list is closed, but show:

    •fopencookie~(void *restrict magic_cookie, const char *restrict modes, cookie_io_functions_t io_funcs) f [LS]
    •FE_OVERFLOW~                                                                                          m [LS]
    
    1. Input <cr>

    Expect cursor on newline, but buffer text is struct fopencookie, there is also no auto include of header files

Extra info

* coc-clangd 0.32.0 ~/.config/coc/extensions/node_modules/coc-clangd
clangd version 19.1.7
Features: linux
Platform: aarch64-unknown-linux-gnu

A4-Tacks avatar Oct 23 '25 08:10 A4-Tacks

Can't reproduce with your mini.vim + nvim/vim both, after input {, the completion window is closed, <cr> will move cursor to newline.

fannheyward avatar Oct 27 '25 06:10 fannheyward

after input {

What if you input struct foo <space> <cr>

A4-Tacks avatar Oct 27 '25 06:10 A4-Tacks

Image Image Image

fannheyward avatar Oct 27 '25 08:10 fannheyward

Image Image Image

A4-Tacks avatar Oct 27 '25 08:10 A4-Tacks

https://github.com/user-attachments/assets/d356506b-c896-41d6-93be-9469c1dc2863

@A4-Tacks I still can't reproduce this, tested with vim + coc-clangd.

fannheyward avatar Dec 12 '25 01:12 fannheyward

The latest version of vim+coc+coc-clangd+clangd is still reproducing

EDIT) It seems that entering other symbols will not close the completion pum, while characters like . will open a new pum

A4-Tacks avatar Dec 12 '25 08:12 A4-Tacks

entering other symbols will not close the completion pum

What's symbols?

fannheyward avatar Dec 12 '25 08:12 fannheyward

What's symbols?

Sorry for the translation ambiguity. It should be punctuation instead of symbols

A4-Tacks avatar Dec 12 '25 09:12 A4-Tacks

From my screenshot, after struct foo, input <space> had close completion pum window, doesn't it work for you?

fannheyward avatar Dec 12 '25 09:12 fannheyward

doesn't it work for you?

Yes

A4-Tacks avatar Dec 12 '25 10:12 A4-Tacks