GNU bug report logs - #79259
[PATCH] Fix arg doc off-by-one bug of eglot signature help

Previous Next

Package: emacs;

Reported by: Lin Jian <me <at> linj.tech>

Date: Sat, 16 Aug 2025 21:49:01 UTC

Severity: normal

Tags: patch

Done: João Távora <joaotavora <at> gmail.com>

Full log


View this message in rfc822 format

From: Lin Jian <me <at> linj.tech>
To: João Távora <joaotavora <at> gmail.com>
Cc: 79259 <at> debbugs.gnu.org
Subject: bug#79259: [PATCH] Fix arg doc off-by-one bug of eglot signature help
Date: Sun, 17 Aug 2025 06:47:38 +0800
[Message part 1 (text/plain, inline)]
João Távora <joaotavora <at> gmail.com> writes:

> Thanks, but I (or whoever) added the 1+ there probably did so for 
> a reason.  

It was added by you[1].

> Maybe they were mistaken, but you have to supply a reproduction recipe
> that demonstrates there's a problem with that, so we can check the 
> before and after, else I could be fixing it for you and breaking it for
> someone else.

I've reported some bugs and I'm familiar with (info "(emacs)Bugs").

I did not include a reproduction recipe in this report because I think
it is trivial to reproduce:

1. use a LSP server supporting argument documentation in the signature
help
2. get one signature help with argument documentation from eglot
3. see the highlight of argument documentation is off-by-one

typescript-language-server is mentioned in the commit[1] adding `1+', so
I guess it can be used for reproduction.

I am developing[2] the signature help feature for
haskell-language-server, which causes me to discover this off-by-one
"bug".

I added two screenshots before and after applying my patch as
attachments.

[without-my-patch.png (image/png, attachment)]
[with-my-patch.png (image/png, attachment)]
[Message part 4 (text/plain, inline)]

Here is the transcript between eglot and my developing
haskell-language-server:

[jsonrpc] e[06:33:30.460] --> textDocument/signatureHelp[192] 
(:jsonrpc "2.0" :id 192 :method "textDocument/signatureHelp" :params
          (:textDocument
           (:uri
            "file:///home/linj/code/origin/hydra-scraper/src/TestHls.hs")
           :position (:line 107 :character 19)))
[jsonrpc] e[06:33:30.471] <-- textDocument/signatureHelp[192] 
(:id 192 :jsonrpc "2.0" :result
     (:activeParameter 0 :activeSignature 0 :signatures
                       [(:activeParameter 0 :documentation
                                          (:kind "markdown" :value
                                                 "\n\nFun doc for  `fsimple` .\n\n")
                                          :label
                                          "fsimple :: forall a. a -> Bool -> Char"
                                          :parameters
                                          [(:documentation
                                            (:kind "markdown" :value
                                                   "\n\nThe first arg.\n\n")
                                            :label [21 22])
                                           (:documentation
                                            (:kind "markdown" :value
                                                   "\n\nThe second  `Bool`  arg.\n\n")
                                            :label [26 30])])
                        (:activeParameter 0 :documentation
                                          (:kind "markdown" :value
                                                 "\n\nFun doc for  `fsimple` .\n\n")
                                          :label
                                          "fsimple :: Integer -> Bool -> Char"
                                          :parameters
                                          [(:documentation
                                            (:kind "markdown" :value
                                                   "\n\nThe first arg.\n\n")
                                            :label [11 18])
                                           (:documentation
                                            (:kind "markdown" :value
                                                   "\n\nThe second  `Bool`  arg.\n\n")
                                            :label [22 26])])]))

> Please see https://joaotavora.github.io/eglot/#Reporting-bugs-1 for how to 
> report an Emacs -Q recipe (including a LSP server setup).

Thanks for the link.  I forgot to check that it before sending my
report.

I do not have time to provide more info now.

I think the above information is probably enough for this bug.  In
particular, the above server reply of signature help should be enough
for reproduction.  If it is not the case, please let me know and I will
provide more info later when I have time.

[1]: e33c0a549153fa3894f3b5e9c5e42ce07a1a68c7
[2]: https://github.com/haskell/haskell-language-server/pull/4626

This bug report was last modified 8 days ago.

Previous Next


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