Skip to content

Eating parentheses during completion #5568

@A4-Tacks

Description

@A4-Tacks

Result from CocInfo

## versions

vim version: VIM - Vi IMproved 9.1 9012077
node version: v25.4.0
coc.nvim version: 0.0.82-78e70b1 2026-03-04 18:45:02 +0800
coc.nvim directory: /home/lrne/.vim/plugged/coc.nvim
term: dumb
platform: linux

## Log of coc.nvim

2026-03-06T22:51:34.169 INFO (pid:18076) [plugin] - coc.nvim initialized with node: v25.4.0 after 504
2026-03-06T22:51:34.173 INFO (pid:18076) [services] - LanguageClient Rust Analyzer Language Server state change: stopped => starting
2026-03-06T22:51:34.196 INFO (pid:18076) [language-client-index] - Language server "rust-analyzer" started with 18090
2026-03-06T22:51:34.222 INFO (pid:18076) [services] - LanguageClient Rust Analyzer Language Server state change: starting => running
2026-03-06T22:51:34.235 INFO (pid:18076) [services] - service rust-analyzer started
2026-03-06T22:51:44.245 INFO (pid:18076) [attach] - Request action: stopCompletion [ 'confirm' ]

Describe the bug

The closing parentheses is eaten during completion

Directly launching rust-analyzer instead of using coc-rust-analyzer still bug,
but VSCode does not have this bug

Reproduce the bug

  • Create file mini.vim with:

    set nocompatible
    set runtimepath^=~/.vim/plugged/coc.nvim
    filetype plugin indent on
    syntax on
    inoremap <silent><expr> <tab> coc#refresh()
    inoremap <silent><expr> <cr> coc#pum#visible() ? coc#pum#confirm() : "<cr>"
  • Create file src/main.rs with:

    fn foo((x, y): (i32, i32)) {}
    fn bar() {}
    
  • Start (neo)vim with command: vim -Nu mini.vim

  • Operate vim.

    1. Cursor on line 2, on (
    2. Input a, cursor after (
    3. Input xy <cr>

Actual:

fn foo((x, y): (i32, i32)) {}
fn bar((x, y): (i32, i32) {}

Expect:

fn foo((x, y): (i32, i32)) {}
fn bar((x, y): (i32, i32)) {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions