Skip to content

Application completion may not have moved the cursor #5411

@A4-Tacks

Description

@A4-Tacks

Result from CocInfo

## versions

vim version: VIM - Vi IMproved 9.1 9011362
node version: v23.9.0
coc.nvim version: 0.0.82-13d0416 2025-07-31 16:32:31 +0800
coc.nvim directory: /home/lrne/.vim/plugged/coc.nvim
term: dumb
platform: linux

## Log of coc.nvim

2025-08-24T08:50:55.614 INFO (pid:15331) [attach] - receive notification: diagnosticNext []
2025-08-24T08:50:56.398 INFO (pid:15331) [plugin] - coc.nvim initialized with node: v23.9.0 after 2151
2025-08-24T08:50:56.414 INFO (pid:15331) [services] - LanguageClient Rust Analyzer Language Server state change: stopped => starting
2025-08-24T08:50:56.463 INFO (pid:15331) [language-client-index] - Language server "rust-analyzer" started with 15362
2025-08-24T08:50:56.556 INFO (pid:15331) [services] - LanguageClient Rust Analyzer Language Server state change: starting => running
2025-08-24T08:50:56.622 INFO (pid:15331) [services] - service rust-analyzer started
2025-08-24T08:51:03.515 INFO (pid:15331) [attach] - receive notification: highlight []
2025-08-24T08:51:54.812 INFO (pid:15331) [attach] - Request action: stopCompletion [ 'confirm' ]
2025-08-24T08:51:54.935 INFO (pid:15331) [snippets-session] - Content change before snippet, reset snippet position
2025-08-24T08:51:54.942 INFO (pid:15331) [snippets-session] - Jump to final placeholder, cancelling snippet session
2025-08-24T08:51:54.950 INFO (pid:15331) [attach] - receive notification: showSignatureHelp []
2025-08-24T08:51:58.728 INFO (pid:15331) [attach] - Request action: stopCompletion [ 'confirm' ]
2025-08-24T08:51:58.756 INFO (pid:15331) [attach] - receive notification: showSignatureHelp []
2025-08-24T08:52:01.061 INFO (pid:15331) [attach] - Request action: stopCompletion [ 'confirm' ]
2025-08-24T08:52:01.090 INFO (pid:15331) [snippets-session] - Content change after snippet
2025-08-24T08:52:01.129 INFO (pid:15331) [snippets-session] - Before and snippet body changed, cancel snippet session
2025-08-24T08:52:17.627 INFO (pid:15331) [attach] - receive notification: showInfo []

Describe the bug

When completing a result containing $0, it may not jump

This bug seems from 8e6549d 6729107 fix(links): fix regex for url

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()
    xmap <F3> <Plug>(coc-codeaction-selected)
    nmap <C-k> <Plug>(coc-diagnostic-prev)
    nmap <C-j> <Plug>(coc-diagnostic-next)
  • Create file coc-settings.json with:

    {
        "rust-analyzer.updates.checkOnStartup": false
    }
  • Start vim with command: vim -Nu mini.vim src/main.rs

  • Operate vim.

    1. Insert Some(3)
    2. Input .let and confirm let~ let
    3. Expect let | = Some(3);, but it may is let = S|ome(3);

Similar, there are also Some(3).lete,

fn main() {
    if let Some() = Some(2) {|
        
    }
}

Expect:

fn main() {
    if let Some(|) = Some(2) {
        
    }
}

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