GNU bug report logs - #73500
eglot: diagnostic location not always shown

Previous Next

Package: emacs;

Reported by: Federico Beffa <federico.beffa <at> fbengineering.ch>

Date: Thu, 26 Sep 2024 15:04:01 UTC

Severity: normal

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: João Távora <joaotavora <at> gmail.com>
To: Federico Beffa <federico.beffa <at> fbengineering.ch>
Cc: 73500 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: bug#73500: eglot: diagnostic location not always shown
Date: Sat, 28 Sep 2024 22:18:00 +0100
On Sat, Sep 28, 2024 at 4:23 PM Federico Beffa <federico.beffa <at> 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




This bug report was last modified 287 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.