Damaged codeAction applyEdits
Result from CocInfo
## versions
vim version: VIM - Vi IMproved 9.1 9011841
node version: v23.9.0
coc.nvim version: 0.0.82-b6f12de 2025-11-14 09:17:47 +0800
coc.nvim directory: /home/lrne/.vim/pack/plugins/opt/coc.nvim
term: dumb
platform: linux
## Log of coc.nvim
2025-11-19T21:35:52.788 INFO (pid:31860) [plugin] - coc.nvim initialized with node: v23.9.0 after 794
2025-11-19T21:35:52.792 INFO (pid:31860) [services] - LanguageClient Rust Analyzer Language Server state change: stopped => starting
2025-11-19T21:35:52.807 INFO (pid:31860) [language-client-index] - Language server "rust-analyzer" started with 31886
2025-11-19T21:35:52.840 INFO (pid:31860) [services] - LanguageClient Rust Analyzer Language Server state change: starting => running
2025-11-19T21:35:52.856 INFO (pid:31860) [services] - service rust-analyzer started
2025-11-19T21:37:21.132 INFO (pid:31860) [attach] - receive notification: codeAction [ 'cursor' ]
2025-11-19T21:37:23.999 INFO (pid:31860) [attach] - Request action: snippetNext []
2025-11-19T21:37:24.582 INFO (pid:31860) [attach] - Request action: snippetNext []
2025-11-19T21:37:25.167 INFO (pid:31860) [attach] - Request action: snippetNext []
Describe the bug
After applying CodeAction, the placeholder order and range for jumping to applyedits are abnormal
Reproduce the bug
We will close your issue when you don't provide minimal vimrc and we can't reproduce it
-
Create file
mini.vimwith: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','')}]%*\ %) packadd coc.nvim filetype plugin indent on syn on 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) nmap K :call CocActionAsync('doHover')<CR> xmap K <cmd>call CocActionAsync('doHover')<CR> augroup coc_user autocmd! " Update statusline autocmd User CocStatusChange redrawstatus augroup end -
Plugin: coc-rust-analyzer
-
Rust-Analyzer from https://github.com/rust-lang/rust-analyzer/releases/tag/2025-11-17
-
Run
cargo new foo && cd foo -
Start (neo)vim with command:
vim -Nu mini.vim src/main.rsfn main() { loop { break; continue; } } -
Operate vim.
-
On
loopinput<F3>useAdd Label -
Input some
<c-j>- expected selected
'lbefore: loop - unexpected cursor before
loop - unexpected selected range
" 'l"afterbreak, expect"'l" - unexpected selected range
" 'l"aftercontinue, expect"'l"
- expected selected
Current:
fn main() { 'l: loop { break 'l; continue 'l; } }Output edits:
fn main() { ${1:'l}: loop { break ${2:'l}; continue ${0:'l}; } } -
If I understand correctly, the output result is correct but <C-j> jumping and selected range is abnormal. Tested with VSCode, after action applied, Tab will jump to break then continue.
Looks like something is broken in SnippetTextEdit feature.
If I understand correctly, the output result is correct but
<C-j>jumping and selected range is abnormal.
Yes, only jumping and selected range are abnormal