Skip to content

InlayHints after completion confirmed #5449

@A4-Tacks

Description

@A4-Tacks

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-16T18:23:16.815 INFO (pid:31812) [plugin] - coc.nvim initialized with node: v23.9.0 after 472
2025-10-16T18:23:16.882 INFO (pid:31812) [services] - service tsserver started
2025-10-16T18:23:33.389 INFO (pid:31812) [attach] - receive notification: startCompletion [ {} ]
2025-10-16T18:23:34.296 INFO (pid:31812) [attach] - Request action: stopCompletion [ 'confirm' ]
2025-10-16T18:23:44.457 INFO (pid:31812) [attach] - receive notification: showInfo []

Describe the bug

After confirming completion, the inlayHint of the parameter is located after the completion text

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
  • Create file coc-settings.json with:

    {
        "typescript.inlayHints.parameterNames.enabled": "all",
        "typescript.inlayHints.functionLikeReturnTypes.enabled": true
    }
  • Start vim with command: vim -Nu mini.vim a.ts

    function foo(bar: number) {}
    let variable = 3;
    foo(v)
  • Operate vim.

    1. Wait for loaded (showing inlayHint)
    2. Cursor after v, current line: foo(bar: v)
    3. Completion variable, expect: foo(bar: variable), buggy: foo(variablebar: )

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions