fannheyward / coc-rust-analyzer

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

How to stop notes from showing-up in the editor? #1213

Closed Seb-C closed 11 months ago

Seb-C commented 11 months ago

What's the output of :CocInfo

## versions

vim version: VIM - Vi IMproved 9.0 9001894
node version: v21.1.0
coc.nvim version: 0.0.82-cf715c5 2023-10-21 16:53:44 +0900
coc.nvim directory: /home/sebastien/.vim/bundle/coc.nvim
term: dumb
platform: linux

## Log of coc.nvim

2023-12-12T18:42:59.342 INFO (pid:96254) [extension:coc-git] - Looking for git in: git
2023-12-12T18:42:59.359 INFO (pid:96254) [plugin] - coc.nvim initialized with node: v21.1.0 after 136
2023-12-12T18:43:01.475 INFO (pid:96254) [services] - LanguageClient Rust Analyzer Language Server state change: stopped => starting
2023-12-12T18:43:01.480 INFO (pid:96254) [language-client-index] - Language server "rust-analyzer" started with 96300
2023-12-12T18:43:01.518 INFO (pid:96254) [services] - LanguageClient Rust Analyzer Language Server state change: starting => running
2023-12-12T18:43:01.523 INFO (pid:96254) [services] - service rust-analyzer started
2023-12-12T18:43:02.492 WARN (pid:96254) [model-progress] - progress window disabled by configuration "notification.disabledProgressSources"
2023-12-12T18:43:04.478 INFO (pid:96254) [attach] - receive notification: runCommand [ 'rust-analyzer.serverVersion' ]
2023-12-12T18:43:20.385 INFO (pid:96254) [attach] - receive notification: showInfo []
2023-12-12T18:43:27.708 ERROR (pid:96254) [node-client] - Error event from nvim: 0 Invalid buffer id: 1 on api "buf_set_var" [1,"coc_git_status",""]
2023-12-12T18:43:31.259 INFO (pid:96254) [attach] - receive notification: showInfo []

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

[coc.nvim] rust-analyzer 1.74.1 (a28077b 2023-12-04)

What's your coc-rust-analyzer version? You can get it from :CocList extensions

0.75.0

Issue

Where there is an error, it shows-up in vim both where the error happens, and where the definition is.

For any other programming languages I only get this kind of annotation in code where there is an actual error (either compile or lint), so I find it very distracting and annoying to get anything to show up in files that are valid.

I looked at the documentation, but could not find how to disable the second one.

screenshot_20231212_183234

It seems to match the note: output of the compiler, which I'd rather not have popping-up in my editor:

error[E0061]: this function takes 2 arguments but 1 argument was supplied
  --> src/lib.rs:14:16
   |
14 |     let book = Book::new(123);
   |                ^^^^^^^^^----- an argument of type `bool` is missing
   |
note: associated function defined here
  --> src/book.rs:11:12
   |
11 |     pub fn new(pages: u32, is_available: bool) -> Book {
   |            ^^^ ----------  ------------------
help: provide the argument
   |
14 |     let book = Book::new(123, /* bool */);
   |                         ~~~~~~~~~~~~~~~~~
fannheyward commented 11 months ago

The errors were returned from the language server, here's rust-analyzer, coc.nvim/coc-rust-analyzer just clients to display them.

Needs the rust-analyzer to provide a way to disable returning note errors.

fannheyward commented 11 months ago

You can use diagnostic.level to filter diagnostics by severity level, the second one looks like hint level. But this will filter all diagnostics.

Seb-C commented 11 months ago

Ah, thanks, that worked :+1: