fannheyward / coc-rust-analyzer

rust-analyzer extension for coc.nvim
MIT License
1.13k stars 39 forks source link

missing actions compared to vscode-rust-analyzer #920

Closed ta3pks closed 2 years ago

ta3pks commented 2 years ago

What's the output of :CocInfo

## versions

vim version: NVIM v0.6.0
node version: v16.9.1
coc.nvim version: 0.0.80-03c9add7cd
coc.nvim directory: /Users/nikos/plugged/coc.nvim
term: WezTerm
platform: darwin

## Log of coc.nvim

2021-12-12T07:46:45.780 INFO (pid:65237) [services] - registered service "rust-analyzer"
2021-12-12T07:46:45.783 INFO (pid:65237) [services] - Rust Analyzer Language Server state change: stopped => starting
2021-12-12T07:46:45.812 INFO (pid:65237) [plugin] - coc.nvim 0.0.80-03c9add7cd initialized with node: v16.9.1 after 1028ms
2021-12-12T07:46:45.816 INFO (pid:65237) [language-client-index] - Language server "rust-analyzer" started with 66265
2021-12-12T07:46:45.825 INFO (pid:65237) [services] - Rust Analyzer Language Server state change: starting => running
2021-12-12T07:46:45.827 INFO (pid:65237) [services] - service rust-analyzer started
2021-12-12T07:46:54.270 INFO (pid:65237) [attach] - receive notification: codeAction [ '' ]
2021-12-12T07:46:57.878 WARN (pid:65237) [plugin] - Slow action "codeAction" cost 3608ms
2021-12-12T07:46:58.913 INFO (pid:65237) [attach] - receive notification: codeAction [ '' ]
2021-12-12T07:46:59.963 WARN (pid:65237) [plugin] - Slow action "codeAction" cost 1050ms
2021-12-12T07:47:06.780 INFO (pid:65237) [attach] - receive notification: diagnosticNext []
2021-12-12T07:47:08.390 INFO (pid:65237) [attach] - receive notification: codeAction [ '' ]
2021-12-12T07:47:09.869 WARN (pid:65237) [model-menu] - Ignored key press: .
2021-12-12T07:47:10.614 WARN (pid:65237) [plugin] - Slow action "codeAction" cost 2223ms
2021-12-12T07:47:12.332 INFO (pid:65237) [attach] - receive notification: diagnosticNext []
2021-12-12T07:47:15.187 INFO (pid:65237) [attach] - receive notification: codeAction [ '' ]
2021-12-12T07:47:15.421 WARN (pid:65237) [model-menu] - Ignored key press: ��.
2021-12-12T07:47:17.393 WARN (pid:65237) [plugin] - Slow action "codeAction" cost 2205ms
2021-12-12T07:47:29.678 INFO (pid:65237) [attach] - receive notification: codeAction [ '' ]
2021-12-12T07:47:37.401 WARN (pid:65237) [plugin] - Slow action "codeAction" cost 7722ms
2021-12-12T07:47:38.237 INFO (pid:65237) [attach] - receive notification: diagnosticNext []
2021-12-12T07:48:43.891 INFO (pid:65237) [attach] - receive notification: diagnosticNext []
2021-12-12T07:49:01.424 INFO (pid:65237) [completion-complete] - Results from: around,buffer
2021-12-12T07:49:01.519 INFO (pid:65237) [completion-complete] - Results from: around,buffer
2021-12-12T07:49:01.728 INFO (pid:65237) [completion-complete] - Results from: around,buffer
2021-12-12T07:49:01.914 INFO (pid:65237) [completion-complete] - Results from: around,buffer
2021-12-12T07:49:02.726 INFO (pid:65237) [completion-complete] - Results from: around,buffer
2021-12-12T07:49:33.874 INFO (pid:65237) [attach] - receive notification: codeAction [ '' ]
2021-12-12T07:50:19.938 WARN (pid:65237) [model-menu] - Ignored key press: <C-j>
2021-12-12T07:50:20.329 WARN (pid:65237) [model-menu] - Ignored key press: <C-k>
2021-12-12T07:50:20.528 WARN (pid:65237) [model-menu] - Ignored key press: <C-j>
2021-12-12T07:50:20.837 WARN (pid:65237) [model-menu] - Ignored key press: <C-k>
2021-12-12T07:50:21.019 WARN (pid:65237) [model-menu] - Ignored key press: <C-j>
2021-12-12T07:52:37.276 WARN (pid:65237) [model-menu] - Ignored key press: :
2021-12-12T07:52:38.140 WARN (pid:65237) [plugin] - Slow action "codeAction" cost 184266ms
2021-12-12T07:52:42.559 INFO (pid:65237) [attach] - receive notification: showInfo []

What's the output of :CocCommand rust-analyzer.serverVersion

rust-analyzer 7d6fcbc0b 2021-12-06 stable

actions such as prefix with _ or rewrite as raw string is missing only the most generic actions show up such as change to pub or extract to a module. image

image

image image image

fannheyward commented 2 years ago

You're using coc-codeaction, try coc-codeaction-cursor. Check :h coc-codeaction-cursor for more infos.

ta3pks commented 2 years ago

@fannheyward is there a way of getting a unified list of codeactions and codeaction-cursors

fannheyward commented 2 years ago

@NikosEfthias No, coc-codeaction sends the whole range of document to language server, coc-codeaction-cursor sends current cursor position to LS.

I recommend to use coc-codeaction-cursor mostly.