* bug#73500: eglot: diagnostic location not always shown
@ 2024-09-26 13:49 Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-28 11:16 ` Eli Zaretskii
2024-10-01 16:08 ` Dmitry Gutov
0 siblings, 2 replies; 18+ messages in thread
From: Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-26 13:49 UTC (permalink / raw)
To: 73500
[-- Attachment #1: Type: text/plain, Size: 1916 bytes --]
I'm using `emacs` 29.4 with the `haskell-language-server` 2.8.0.0 on
NixOS 24.05.
The following code
```haskell
isAscending [x] =True
```
produces the following diagnostic from the lsp
```elisp
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
(:diagnostics
[(:code "-Wunused-matches" :message "Defined but not used:
‘x’" :range
(:end
(:character 14 :line 17)
:start
(:character 13 :line 17))
:severity 2 :source "typecheck" :tags
[1])
(:code "-Wmissing-signatures" :message "Top-level binding
with no type signature:\n fbeCircle ::
svg-builder-0.1.1:Graphics.Svg.Core.Element" :range
(:end
(:character 9 :line 25)
:start
(:character 0 :line 25))
:severity 2 :source "typecheck")]
:uri
"file:///home/user/tmp/haskell/test-flake-utils/test/src/Main.hs"
:version 0))
```
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.
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.
[-- Attachment #2: Type: text/html, Size: 2827 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#73500: eglot: diagnostic location not always shown
2024-09-26 13:49 bug#73500: eglot: diagnostic location not always shown Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-28 11:16 ` Eli Zaretskii
2024-09-28 11:47 ` João Távora
2024-10-01 16:08 ` Dmitry Gutov
1 sibling, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2024-09-28 11:16 UTC (permalink / raw)
To: Federico Beffa, João Távora; +Cc: 73500
> Date: Thu, 26 Sep 2024 15:49:41 +0200
> From: Federico Beffa via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
> I'm using `emacs` 29.4 with the `haskell-language-server` 2.8.0.0 on NixOS 24.05.
>
> The following code
> ```haskell
> isAscending [x] = True
> ```
> produces the following diagnostic from the lsp
> ```elisp
> (:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
> (:diagnostics
> [(:code "-Wunused-matches" :message "Defined but not used: ‘x’" :range
> (:end
> (:character 14 :line 17)
> :start
> (:character 13 :line 17))
> :severity 2 :source "typecheck" :tags
> [1])
> (:code "-Wmissing-signatures" :message "Top-level binding with no type signature:\n fbeCircle ::
> svg-builder-0.1.1:Graphics.Svg.Core.Element" :range
> (:end
> (:character 9 :line 25)
> :start
> (:character 0 :line 25))
> :severity 2 :source "typecheck")]
> :uri "file:///home/user/tmp/haskell/test-flake-utils/test/src/Main.hs" :version 0))
> ```
> 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.
>
> 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.
João, any comments or suggestions?
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#73500: eglot: diagnostic location not always shown
2024-09-28 11:16 ` Eli Zaretskii
@ 2024-09-28 11:47 ` João Távora
2024-09-28 15:23 ` Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 18+ messages in thread
From: João Távora @ 2024-09-28 11:47 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 73500, Federico Beffa
I would expect a 1-character long underline for the first one too.
There might be a off-by-one error somewhere, but I doubt it. I just
tried with clangd a a diagnostic like this:
{"code":"unknown_typename","message":"Unknown type name 'a'",
"range":{"end":{"character":1,"line":34},"start":{"character":0,"line":34}},
"severity":1,"source":"clang"}
gets its own small underline.
So, maybe look closer and if you still don't see it, follow the steps in
https://joaotavora.github.io/eglot/#Reporting-bugs
and construct a full error recipe so that we can (not) see it, too.
João
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#73500: eglot: diagnostic location not always shown
2024-09-28 11:47 ` João Távora
@ 2024-09-28 15:23 ` Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-28 21:18 ` João Távora
0 siblings, 1 reply; 18+ messages in thread
From: Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-28 15:23 UTC (permalink / raw)
To: João Távora, Eli Zaretskii; +Cc: 73500
[-- Attachment #1.1: Type: text/plain, Size: 1080 bytes --]
The attached archive includes everything mentioned at the indicated link.
See the included `README.md` file for instructions on how to reproduce
the bug (minimally).
It also points to instructions on how to install the Haskell tools, but,
given that https://github.com/joaotavora/eglot claims support for the
`haskell-language-server` (and to be up-to-date) I assume you have
running test benches with everything.
On 28/09/2024 13:47, João Távora wrote:
> I would expect a 1-character long underline for the first one too.
>
> There might be a off-by-one error somewhere, but I doubt it. I just
> tried with clangd a a diagnostic like this:
>
> {"code":"unknown_typename","message":"Unknown type name 'a'",
> "range":{"end":{"character":1,"line":34},"start":{"character":0,"line":34}},
> "severity":1,"source":"clang"}
>
> gets its own small underline.
>
> So, maybe look closer and if you still don't see it, follow the steps in
>
> https://joaotavora.github.io/eglot/#Reporting-bugs
>
> and construct a full error recipe so that we can (not) see it, too.
>
> João
[-- Attachment #1.2: Type: text/html, Size: 1737 bytes --]
[-- Attachment #2: bug73500.tgz --]
[-- Type: application/x-compressed-tar, Size: 290882 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#73500: eglot: diagnostic location not always shown
2024-09-28 15:23 ` Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-28 21:18 ` João Távora
[not found] ` <452a24b1-14e8-40a6-b921-a26522278a82@fbengineering.ch>
0 siblings, 1 reply; 18+ messages in thread
From: João Távora @ 2024-09-28 21:18 UTC (permalink / raw)
To: Federico Beffa; +Cc: 73500, Eli Zaretskii
On Sat, Sep 28, 2024 at 4:23 PM Federico Beffa <federico.beffa@fbengineering.ch> wrote:
>
> The attached archive includes everything mentioned at the indicated
> link. See the included `README.md` file for instructions on how to
> reproduce the bug (minimally).
Thanks.
> assume you have running test benches with everything.
You assume wrong. Eglot supports hundreds of servers. I only have the
servers I work or worked with in the past. "Supports foo server " means
solely that someone knowledgeable with foo tried it and reported good
results at some point, so they requested to add a server invocation to
eglot-server-programs.
Anyway, I couldn't reproduce your problem simply because the Main.hs
program you provided does not seem to produce any diagnostics, according
the haskell-language-server I installed in my system, which identifies
itself as
haskell-language-server version: 1.9.1.0 (GHC: 9.2.8) (PATH: /usr/bin/haskell-language-server)
I'm not a Haskell programmer, so I don't know if this makes sense to
you.
In the events log, the publishDiagonstics message is the following:
[jsonrpc] e[22:01:33.466] <-- textDocument/publishDiagnostics {
"jsonrpc": "2.0",
"method": "textDocument/publishDiagnostics",
"params": {
"diagnostics": [],
"uri": "file:///home/capitaomorte/Downloads/bug73500/src/Main.hs",
"version": 2
}
}
Notice the empty JSON array. However, when I change your Main.hs to
what is likely a nonsensical Haskell program:
module Main where
isAscending :: [Int] -> Bool
isAscending [] = True
isAscending [x] = x
-- ^ this second 'x' _is_ underlined
isAscending (x : y : ys) = x < y && isAscending (y : ys)
main :: IO ()
main = putStrLn "Hello, bug 73500!"
Then I see the second x being underlined with a 1-char-long diagnostic,
the corresponding LSP event being:
[jsonrpc] e[22:05:21.403] <-- textDocument/publishDiagnostics {
"jsonrpc": "2.0",
"method": "textDocument/publishDiagnostics",
"params": {
"diagnostics": [
{
"code": "-Wdeferred-type-errors",
"message": "• Couldn't match expected type ‘Bool’ with actual type ‘Int’\n• In the expression: x\n In an equation for ‘isAscending’: isAscending [x] = x",
"range": {
"end": {
"character": 19,
"line": 4
},
"start": {
"character": 18,
"line": 4
}
},
"severity": 1,
"source": "typecheck"
}
],
"uri": "file:///home/capitaomorte/Downloads/bug73500/src/Main.hs",
"version": 25
}
}
I have now removed haskell-language-server from my machine.
João
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#73500: eglot: diagnostic location not always shown
2024-09-26 13:49 bug#73500: eglot: diagnostic location not always shown Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-28 11:16 ` Eli Zaretskii
@ 2024-10-01 16:08 ` Dmitry Gutov
2024-10-01 16:32 ` Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 1 reply; 18+ messages in thread
From: Dmitry Gutov @ 2024-10-01 16:08 UTC (permalink / raw)
To: Federico Beffa, 73500
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’
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#73500: eglot: diagnostic location not always shown
2024-10-01 16:08 ` Dmitry Gutov
@ 2024-10-01 16:32 ` Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-01 19:48 ` Dmitry Gutov
0 siblings, 1 reply; 18+ messages in thread
From: Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-01 16:32 UTC (permalink / raw)
To: Dmitry Gutov, 73500
[-- Attachment #1: Type: text/plain, Size: 1467 bytes --]
Thanks for the constructive answer!
On 01/10/2024 18:08, Dmitry Gutov wrote:
> 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?
>
No, not really. The initial report included a single line code example
that I extracted from a slightly longer example and produces 3
diagnostics, one more than the full code that I was using. In the
following emails I sent the following full example:
```haskell
module Main where
isAscending :: [Int] -> Bool
isAscending [] = True
isAscending [x] = True
-- ^ thix 'x' is not underlined!
isAscending (x : y : ys) = x < y && isAscending (y : ys)
main :: IO ()
main = putStrLn "Hello, bug 73500!"
```
Here I see the fringe exclamation mark on the line above the comment,
but no underline anywhere. What I'd expect is to see the `x` underlined
(comment likely off due to non-monospaced fonts in the email).
> One existing way to see the warnings separate from each other is
> invoke Flymake's diagnostics buffer: 'M-x
> flymake-show-buffer-diagnostics'. -matches]: Defined but not used: ‘x’
>
Yes, `flymake-show-buffer-diagnostics` shows the diagnostic
5 13 warning e-f-b typecheck [-Wunused-matches]: Defined but
not used: ‘x’
It's just the missing underline that's unexpected. Here a screenshot
[-- Attachment #2.1: Type: text/html, Size: 2398 bytes --]
[-- Attachment #2.2: Smr3V0zrFH5D99G7.png --]
[-- Type: image/png, Size: 27676 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#73500: eglot: diagnostic location not always shown
2024-10-01 16:32 ` Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-01 19:48 ` Dmitry Gutov
2024-10-01 20:18 ` Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 18+ messages in thread
From: Dmitry Gutov @ 2024-10-01 19:48 UTC (permalink / raw)
To: Federico Beffa, 73500
On 01/10/2024 19:32, Federico Beffa wrote:
>> 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?
>>
>
> No, not really. The initial report included a single line code example
> that I extracted from a slightly longer example and produces 3
> diagnostics, one more than the full code that I was using. In the
> following emails I sent the following full example:
Great! I guess it exhibits something I haven't noticed.
> ```haskell
> module Main where
>
> isAscending :: [Int] -> Bool
> isAscending [] = True
> isAscending [x] = True
> -- ^ thix 'x' is not underlined!
> isAscending (x : y : ys) = x < y && isAscending (y : ys)
>
> main :: IO ()
> main = putStrLn "Hello, bug 73500!"
> ```
>
> Here I see the fringe exclamation mark on the line above the comment,
> but no underline anywhere. What I'd expect is to see the `x` underlined
> (comment likely off due to non-monospaced fonts in the email).
That one is using the face eglot-diagnostic-tag-unnecessary-face, which
you can customize to add an underline or any other decorations.
It was added in commit 0f44d338f17bd4, see the description here
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=0f44d338f17bd4
The choice of using 'shadow' is explained with a reference to the
protocol, which says:
/**
* Unused or unnecessary code.
*
* Clients are allowed to render diagnostics with this tag faded out
* instead of having an error squiggle.
*/
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticTag
> Here a screenshot
Same look on my machine.
Should we remove the exclamation point instead, to avoid the semantic
conflict? I'm not sure, probably not.
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#73500: eglot: diagnostic location not always shown
2024-10-01 19:48 ` Dmitry Gutov
@ 2024-10-01 20:18 ` Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-01 20:39 ` Dmitry Gutov
0 siblings, 1 reply; 18+ messages in thread
From: Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-01 20:18 UTC (permalink / raw)
To: Dmitry Gutov, 73500
[-- Attachment #1: Type: text/plain, Size: 1180 bytes --]
On 01/10/2024 21:48, Dmitry Gutov wrote:
> That one is using the face eglot-diagnostic-tag-unnecessary-face,
> which you can customize to add an underline or any other decorations.
>
> It was added in commit 0f44d338f17bd4, see the description here
> https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=0f44d338f17bd4
>
> The choice of using 'shadow' is explained with a reference to the
> protocol, which says:
>
> /**
> * Unused or unnecessary code.
> *
> * Clients are allowed to render diagnostics with this tag faded out
> * instead of having an error squiggle.
> */
>
> https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticTag
>
>
OK, I see, the shadow is so similar the normal font that, before you
mentioned it, it was unnoticeable to me. But if it's customizable,
that's great.
> > Here a screenshot
>
> Same look on my machine.
>
> Should we remove the exclamation point instead, to avoid the semantic
> conflict? I'm not sure, probably not.
Is the exclamation mark used with all warnings? If yes, I'd keep it.
Even if the warning has a tag equal to 1, it's still a warning.
Thanks for your help!
[-- Attachment #2: Type: text/html, Size: 2281 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#73500: eglot: diagnostic location not always shown
2024-10-01 20:18 ` Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-01 20:39 ` Dmitry Gutov
0 siblings, 0 replies; 18+ messages in thread
From: Dmitry Gutov @ 2024-10-01 20:39 UTC (permalink / raw)
To: Federico Beffa, 73500-done
On 01/10/2024 23:18, Federico Beffa wrote:
> On 01/10/2024 21:48, Dmitry Gutov wrote:
>> That one is using the face eglot-diagnostic-tag-unnecessary-face,
>> which you can customize to add an underline or any other decorations.
>>
>> It was added in commit 0f44d338f17bd4, see the description here
>> https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=0f44d338f17bd4
>>
>> The choice of using 'shadow' is explained with a reference to the
>> protocol, which says:
>>
>> /**
>> * Unused or unnecessary code.
>> *
>> * Clients are allowed to render diagnostics with this tag faded out
>> * instead of having an error squiggle.
>> */
>>
>> https://microsoft.github.io/language-server-protocol/specifications/
>> lsp/3.17/specification/#diagnosticTag
>>
>
> OK, I see, the shadow is so similar the normal font that, before you
> mentioned it, it was unnoticeable to me. But if it's customizable,
> that's great.
Yep. I suggest customizing 'shadow' itself then, if it's not noticeable
enough on your system/theme/etc.
>> > Here a screenshot
>>
>> Same look on my machine.
>>
>> Should we remove the exclamation point instead, to avoid the semantic
>> conflict? I'm not sure, probably not.
>
> Is the exclamation mark used with all warnings? If yes, I'd keep it.
> Even if the warning has a tag equal to 1, it's still a warning.
It is. Sure.
> Thanks for your help!
No problem! Guess we're finished here, so I'm closing the report.
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2024-10-01 20:39 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-26 13:49 bug#73500: eglot: diagnostic location not always shown Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-28 11:16 ` Eli Zaretskii
2024-09-28 11:47 ` João Távora
2024-09-28 15:23 ` Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-28 21:18 ` João Távora
[not found] ` <452a24b1-14e8-40a6-b921-a26522278a82@fbengineering.ch>
2024-09-29 17:20 ` João Távora
2024-09-29 18:59 ` Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-29 21:18 ` João Távora
2024-09-30 9:19 ` Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-30 9:41 ` João Távora
[not found] ` <bee5efd8-c015-43d1-b37d-392d4ffc08d7@fbengineering.ch>
[not found] ` <CALDnm501CMXD8x_9s6Hm0fD5_+K4wmH58t7wXf5buKDuU+=vGg@mail.gmail.com>
2024-09-30 12:08 ` Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-30 15:32 ` João Távora
2024-09-30 15:45 ` Federico Beffa
2024-10-01 16:08 ` Dmitry Gutov
2024-10-01 16:32 ` Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-01 19:48 ` Dmitry Gutov
2024-10-01 20:18 ` Federico Beffa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-01 20:39 ` Dmitry Gutov
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).