neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.15k stars 953 forks source link

Error on notification "codeAction": code action without data #5023

Closed YuhanLiin closed 1 month ago

YuhanLiin commented 1 month ago

Result from CocInfo

vim version: NVIM v0.9.4
node version: v20.13.1
coc.nvim version: 0.0.82-2c7e7156 2024-05-15 09:42:33 +0800
coc.nvim directory: /home/yuhan/.vim/plugged/coc.nvim
term: xterm-256color
platform: linux

## Log of coc.nvim

2024-05-25T15:45:18.675 INFO (pid:1179478) [plugin] - coc.nvim initialized with node: v20.13.1 after 240
2024-05-25T15:45:18.677 INFO (pid:1179478) [services] - LanguageClient Rust Analyzer Language Server state change: stopped => starting
2024-05-25T15:45:18.689 INFO (pid:1179478) [language-client-index] - Language server "rust-analyzer" started with 1179491
2024-05-25T15:45:18.706 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:18.717 INFO (pid:1179478) [services] - LanguageClient Rust Analyzer Language Server state change: starting => running
2024-05-25T15:45:18.729 INFO (pid:1179478) [services] - service rust-analyzer started
2024-05-25T15:45:20.107 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:20.756 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:21.316 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:22.854 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:23.996 INFO (pid:1179478) [attach] - receive notification: codeAction [ 'cursor' ]
2024-05-25T15:45:24.311 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:25.703 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:26.304 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:26.896 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:27.685 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:41.903 INFO (pid:1179478) [attach] - receive notification: codeAction [ 'cursor' ]
2024-05-25T15:45:42.210 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:43.151 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:43.499 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:43.917 INFO (pid:1179478) [attach] - receive notification: codeAction [ 'cursor' ]
2024-05-25T15:45:44.223 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:44.822 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:45.247 INFO (pid:1179478) [attach] - receive notification: codeAction [ 'cursor' ]
2024-05-25T15:45:45.554 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:46.417 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:47.064 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:47.806 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:48.220 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:51.441 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:51.441 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:52.754 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:52.755 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:54.145 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:54.145 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:54.574 INFO (pid:1179478) [attach] - receive notification: codeAction [ 'cursor' ]
2024-05-25T15:45:56.410 ERROR (pid:1179478) [attach] - Error on notification codeAction _ResponseError: code action without data
    at handleResponse (/home/yuhan/.vim/plugged/coc.nvim/build/index.js:20190:40)
    at handleMessage (/home/yuhan/.vim/plugged/coc.nvim/build/index.js:20000:11)
    at processMessageQueue (/home/yuhan/.vim/plugged/coc.nvim/build/index.js:20015:13)
    at Immediate.<anonymous> (/home/yuhan/.vim/plugged/coc.nvim/build/index.js:19991:11)
    at process.processImmediate (node:internal/timers:478:21) {
  code: -32602,
  data: undefined
}
2024-05-25T15:45:56.707 INFO (pid:1179478) [attach] - receive notification: highlight []
2024-05-25T15:45:56.707 INFO (pid:1179478) [attach] - receive notification: highlight []

Extensions

coc-rust-analyzer: 0.76.1

Describe the bug

When I try to execute a code action, it fails with the error message Error on notification "codeAction": code action without data.

Reproduce the bug

nmap aa (coc-codeaction-cursor) xmap aa (coc-codeaction-selected)



- Start neovim with `vim -u mini.vim` and open any source file in a Rust crate.

- Go to any function, field, or type name and input `aa` to open the code action dropdown

- Select any code action using the number key.

The bug happens regardless of whether neovim is in normal mode or visual mode.
fannheyward commented 1 month ago

Can't reproduce, what code action do you run?

YuhanLiin commented 1 month ago

It happens with every code action I've tried

YuhanLiin commented 1 month ago

My CocConfig BTW:

{
    "coc.preferences.formatOnSaveFiletypes": ["rust"],
    "diagnostic.enable": true,
    "diagnostic.checkCurrentLine": false,
    "languageserver": {},
    "rust-analyzer.checkOnSave.command": "clippy",
    "rust-analyzer.loadOutDirsFromCheck": true,
    "workspace.ignoredFolders": [
      "$HOME",
      "$HOME/.cargo/**",
      "$HOME/.rustup/**"
    ],
    "rust-analyzer.procMacro.enable": true
}
YuhanLiin commented 1 month ago

OK I just removed coc-rust-analyzer from my vimrc and reinstalled it via CocInstall, and now code actions work again.