fannheyward / coc-rust-analyzer

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

Diagnostics don't follow text as it moves #1257

Closed bal-e closed 1 month ago

bal-e commented 1 month ago

Problem: If I switch to Insert mode, add some lines, then exit back to Normal mode, the highlighting and underlines for diagnostics get shifted to the wrong positions. I don't observe this with other coc extensions like clangd. I really hope this isn't expected behavior -- the extension should track which text is marked with a diagnostic and ensure that it matches what the user sees in the editor.

Here's a recording of this happening: https://asciinema.org/a/llOJYua9fhfENKz7BgKIlOg3q.

Here's the output of :CocInfo:

## versions

vim version: NVIM v0.10.0
node version: v18.20.3
coc.nvim version: 0.0.82-56632971 2024-07-04 19:25:14 +0800
coc.nvim directory: $HOME/.local/share/nvim/site/pack/packer/start/coc.nvim
term: alacritty
platform: linux

## Log of coc.nvim

2024-07-10T12:47:18.688 INFO (pid:17374) [configurations] - Add folder configuration from cwd: /$PROJECT/.vim/coc-settings.json
2024-07-10T12:47:18.864 INFO (pid:17374) [plugin] - coc.nvim initialized with node: v18.20.3 after 262
2024-07-10T12:47:18.866 INFO (pid:17374) [services] - LanguageClient Rust Analyzer Language Server state change: stopped => starting
2024-07-10T12:47:18.877 INFO (pid:17374) [language-client-index] - Language server "rust-analyzer" started with 17387
2024-07-10T12:47:18.936 INFO (pid:17374) [services] - LanguageClient Rust Analyzer Language Server state change: starting => running
2024-07-10T12:47:18.944 INFO (pid:17374) [services] - service rust-analyzer started

rust-analyzer version: 1.81.0-nightly (20ae37c 2024-07-07)

coc-rust-analyzer version: 0.76.1

fannheyward commented 1 month ago

You need to save first, rust-analyzer can only run check on saving.

image

Same issue with VSCode + rust-analyzer.