Subject: Re: bug#73500: eglot: diagnostic location not always shown

From: Dmitry Gutov <[email-masked]>
Date: Tue, 1 Oct 2024 19:08:08 +0300

Hi!

I cannot comment on the whole previous discussion, but what I'm seeing 
here's is both diagnostics are rendered, but one of them (the first one) 
gets lost inside the second one visually.

Is that the problem?

On 26/09/2024 16:49, Federico Beffa via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> The first diagnostics (corresponding to the above code) is shown in the 
> Emacs buffer only with an exclamation mark in the fringe. However, the 
> diagnostic message is not shown anywhere unless the cursor is placed on 
> the exact location in question (the 'x' in the square brakes). Without 
> any visual aid, it's very difficult to pinpoint the exact location of 
> the problem to see the message.

That's a fair complaint, but we have a limited number of tools at our 
disposal. For warnings, we use underlines, and the color of the 
underline is set. When there are several diagnostics in the same place, 
they can get difficult to distinguish, true.

> The other diagnostic in the same server message, on top of the 
> exclamation mark, it's properly highlighted with a blue wiggled 
> underline and easy to locate. I'd expect this to happen for all diagnostics.

When you say "this", what exactly would you expect to happen, and when?

Eglot prints diagnostics (through Flymake) at the positions that the 
language server reports them for. The second diagnostic spans the whole 
line; the first one is reported to be just 1 character long.

One existing way to see the warnings separate from each other is invoke 
Flymake's diagnostics buffer: 'M-x flymake-show-buffer-diagnostics'. It 
shows this:

     1   1 warning  e-f-b    typecheck [-Wmissing-signatures]: Top-level 
binding with no type signature:
     1   1 warning  e-f-b    compile [-Wincomplete-patterns]: Pattern 
match(es) are non-exhaustive
     1  14 warning  e-f-b    typecheck [-Wunused-matches]: Defined but 
not used: ‘x’