GNU bug report logs - #74914
30.0.90; Eglot: Incorrect parameter highlighted in signatureHelp

Previous Next

Package: emacs;

Reported by: Troy Brown <brownts <at> troybrown.dev>

Date: Mon, 16 Dec 2024 15:20:01 UTC

Severity: normal

Tags: patch

Found in version 30.0.90

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 74914 in the body.
You can then email your comments to 74914 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#74914; Package emacs. (Mon, 16 Dec 2024 15:20:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Troy Brown <brownts <at> troybrown.dev>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 16 Dec 2024 15:20:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Troy Brown <brownts <at> troybrown.dev>
To: "simon254--- via Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
Cc: Felician Nemeth <felician.nemeth <at> gmail.com>,
 João Távora <joaotavora <at> gmail.com>
Subject: 30.0.90; Eglot: Incorrect parameter highlighted in signatureHelp
Date: Mon, 16 Dec 2024 10:19:14 -0500
I'm working with a language server that provides an `activeParameter`
field both in SignatureHelp (set to 0) as well as in
SignatureInformation (set to 1).  Under this condition, for the
signature output in the echo area, Eglot always displays the first
parameter (i.e., index 0).  According to the LSP specification, when
an `activeParameter` field is specified in SignatureInformation "this
is used in place of `SignatureHelp.activeParameter`".  The following
is a partial log covering this transaction:

[jsonrpc] e[09:50:52.423] --> textDocument/signatureHelp[97]
{"jsonrpc":"2.0","id":97,"method":"textDocument/signatureHelp","params":{"textDocument":{"uri":"file:///home/troy/junk/gtkada_24.0.0_80c56171/src/glib.adb"},"position":{"line":102,"character":38}}}
[jsonrpc] e[09:50:52.444] <-- textDocument/publishDiagnostics
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/troy/junk/gtkada_24.0.0_80c56171/src/glib.adb","diagnostics":[{"range":{"start":{"line":102,"character":38},"end":{"line":102,"character":39}},"source":"libadalang","message":"Missing
';'"},{"range":{"start":{"line":102,"character":38},"end":{"line":102,"character":39}},"source":"libadalang","message":"Skipped
token )"},{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"severity":4,"source":"ada.project","message":""}]}}
[jsonrpc] e[09:50:52.445] <-- textDocument/hover[95]
{"jsonrpc":"2.0","id":95,"result":null}
[jsonrpc] e[09:50:52.454] <-- textDocument/documentHighlight[96]
{"jsonrpc":"2.0","id":96,"result":null}
[jsonrpc] e[09:50:52.454] <-- textDocument/signatureHelp[97]
{"jsonrpc":"2.0","id":97,"result":{"signatures":[{"label":"function
Internal (Name : String; Thing : String) return
GType","documentation":"","parameters":[{"label":"Name"},{"label":"Thing"}],"activeParameter":1}],"activeSignature":0,"activeParameter":0}}

I believe the reason for Eglot's behavior is due to the way
"active-param" is specified in the cl-loop within `eglot--sig-info`.
```text
with active-param = (or sig-active activeParameter)
```
The value of activeParameter in SignatureInformation (activeParameter)
should be given higher priority (i.e., listed first) over the
activeParameter specified in SignatureHelp (sig-active).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74914; Package emacs. (Mon, 23 Dec 2024 15:55:02 GMT) Full text and rfc822 format available.

Message #8 received at 74914 <at> debbugs.gnu.org (full text, mbox):

From: Troy Brown <brownts <at> troybrown.dev>
To: 74914 <at> debbugs.gnu.org
Cc: Felician Nemeth <felician.nemeth <at> gmail.com>,
 João Távora <joaotavora <at> gmail.com>
Subject: Re: bug#74914: Acknowledgement (30.0.90; Eglot: Incorrect parameter
 highlighted in signatureHelp)
Date: Mon, 23 Dec 2024 10:54:22 -0500
FYI, this appears to be a regression introduced by
e33c0a549153fa3894f3b5e9c5e42ce07a1a68c7


Troy.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74914; Package emacs. (Sat, 28 Dec 2024 11:35:02 GMT) Full text and rfc822 format available.

Message #11 received at 74914 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Troy Brown <brownts <at> troybrown.dev>, joaotavora <at> gmail.com
Cc: felician.nemeth <at> gmail.com, 74914 <at> debbugs.gnu.org
Subject: Re: bug#74914: 30.0.90;
 Eglot: Incorrect parameter highlighted in signatureHelp
Date: Sat, 28 Dec 2024 13:33:51 +0200
> Cc: Felician Nemeth <felician.nemeth <at> gmail.com>,
>  João Távora <joaotavora <at> gmail.com>
> From: Troy Brown <brownts <at> troybrown.dev>
> Date: Mon, 16 Dec 2024 10:19:14 -0500
> 
> I'm working with a language server that provides an `activeParameter`
> field both in SignatureHelp (set to 0) as well as in
> SignatureInformation (set to 1).  Under this condition, for the
> signature output in the echo area, Eglot always displays the first
> parameter (i.e., index 0).  According to the LSP specification, when
> an `activeParameter` field is specified in SignatureInformation "this
> is used in place of `SignatureHelp.activeParameter`".  The following
> is a partial log covering this transaction:
> 
> [jsonrpc] e[09:50:52.423] --> textDocument/signatureHelp[97]
> {"jsonrpc":"2.0","id":97,"method":"textDocument/signatureHelp","params":{"textDocument":{"uri":"file:///home/troy/junk/gtkada_24.0.0_80c56171/src/glib.adb"},"position":{"line":102,"character":38}}}
> [jsonrpc] e[09:50:52.444] <-- textDocument/publishDiagnostics
> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/troy/junk/gtkada_24.0.0_80c56171/src/glib.adb","diagnostics":[{"range":{"start":{"line":102,"character":38},"end":{"line":102,"character":39}},"source":"libadalang","message":"Missing
> ';'"},{"range":{"start":{"line":102,"character":38},"end":{"line":102,"character":39}},"source":"libadalang","message":"Skipped
> token )"},{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"severity":4,"source":"ada.project","message":""}]}}
> [jsonrpc] e[09:50:52.445] <-- textDocument/hover[95]
> {"jsonrpc":"2.0","id":95,"result":null}
> [jsonrpc] e[09:50:52.454] <-- textDocument/documentHighlight[96]
> {"jsonrpc":"2.0","id":96,"result":null}
> [jsonrpc] e[09:50:52.454] <-- textDocument/signatureHelp[97]
> {"jsonrpc":"2.0","id":97,"result":{"signatures":[{"label":"function
> Internal (Name : String; Thing : String) return
> GType","documentation":"","parameters":[{"label":"Name"},{"label":"Thing"}],"activeParameter":1}],"activeSignature":0,"activeParameter":0}}
> 
> I believe the reason for Eglot's behavior is due to the way
> "active-param" is specified in the cl-loop within `eglot--sig-info`.
> ```text
> with active-param = (or sig-active activeParameter)
> ```
> The value of activeParameter in SignatureInformation (activeParameter)
> should be given higher priority (i.e., listed first) over the
> activeParameter specified in SignatureHelp (sig-active).

João, any comments or suggestions?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74914; Package emacs. (Sat, 28 Dec 2024 13:30:02 GMT) Full text and rfc822 format available.

Message #14 received at 74914 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Troy Brown <brownts <at> troybrown.dev>,
 Felician Nemeth <felician.nemeth <at> gmail.com>, 74914 <at> debbugs.gnu.org
Subject: Re: bug#74914: 30.0.90;
 Eglot: Incorrect parameter highlighted in signatureHelp
Date: Sat, 28 Dec 2024 13:28:12 +0000
[Message part 1 (text/plain, inline)]
This looks like it's good, but i'd have to double check in 2025 (away from
my machine until then) unless Felician is confident and signs off on it.

João

On Sat, Dec 28, 2024, 11:33 Eli Zaretskii <eliz <at> gnu.org> wrote:

> > Cc: Felician Nemeth <felician.nemeth <at> gmail.com>,
> >  João Távora <joaotavora <at> gmail.com>
> > From: Troy Brown <brownts <at> troybrown.dev>
> > Date: Mon, 16 Dec 2024 10:19:14 -0500
> >
> > I'm working with a language server that provides an `activeParameter`
> > field both in SignatureHelp (set to 0) as well as in
> > SignatureInformation (set to 1).  Under this condition, for the
> > signature output in the echo area, Eglot always displays the first
> > parameter (i.e., index 0).  According to the LSP specification, when
> > an `activeParameter` field is specified in SignatureInformation "this
> > is used in place of `SignatureHelp.activeParameter`".  The following
> > is a partial log covering this transaction:
> >
> > [jsonrpc] e[09:50:52.423] --> textDocument/signatureHelp[97]
> >
> {"jsonrpc":"2.0","id":97,"method":"textDocument/signatureHelp","params":{"textDocument":{"uri":"file:///home/troy/junk/gtkada_24.0.0_80c56171/src/glib.adb"},"position":{"line":102,"character":38}}}
> > [jsonrpc] e[09:50:52.444] <-- textDocument/publishDiagnostics
> >
> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/troy/junk/gtkada_24.0.0_80c56171/src/glib.adb","diagnostics":[{"range":{"start":{"line":102,"character":38},"end":{"line":102,"character":39}},"source":"libadalang","message":"Missing
> >
> ';'"},{"range":{"start":{"line":102,"character":38},"end":{"line":102,"character":39}},"source":"libadalang","message":"Skipped
> > token
> )"},{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"severity":4,"source":"ada.project","message":""}]}}
> > [jsonrpc] e[09:50:52.445] <-- textDocument/hover[95]
> > {"jsonrpc":"2.0","id":95,"result":null}
> > [jsonrpc] e[09:50:52.454] <-- textDocument/documentHighlight[96]
> > {"jsonrpc":"2.0","id":96,"result":null}
> > [jsonrpc] e[09:50:52.454] <-- textDocument/signatureHelp[97]
> > {"jsonrpc":"2.0","id":97,"result":{"signatures":[{"label":"function
> > Internal (Name : String; Thing : String) return
> >
> GType","documentation":"","parameters":[{"label":"Name"},{"label":"Thing"}],"activeParameter":1}],"activeSignature":0,"activeParameter":0}}
> >
> > I believe the reason for Eglot's behavior is due to the way
> > "active-param" is specified in the cl-loop within `eglot--sig-info`.
> > ```text
> > with active-param = (or sig-active activeParameter)
> > ```
> > The value of activeParameter in SignatureInformation (activeParameter)
> > should be given higher priority (i.e., listed first) over the
> > activeParameter specified in SignatureHelp (sig-active).
>
> João, any comments or suggestions?
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74914; Package emacs. (Sun, 29 Dec 2024 03:24:01 GMT) Full text and rfc822 format available.

Message #17 received at 74914 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Troy Brown <brownts <at> troybrown.dev>, 74914 <at> debbugs.gnu.org
Cc: Felician Nemeth <felician.nemeth <at> gmail.com>,
 João Távora <joaotavora <at> gmail.com>
Subject: Re: bug#74914: 30.0.90; Eglot: Incorrect parameter highlighted in
 signatureHelp
Date: Sun, 29 Dec 2024 05:22:48 +0200
Hi!

On 16/12/2024 17:19, Troy Brown wrote:
> I believe the reason for Eglot's behavior is due to the way
> "active-param" is specified in the cl-loop within `eglot--sig-info`.
> ```text
> with active-param = (or sig-active activeParameter)
> ```
> The value of activeParameter in SignatureInformation (activeParameter)
> should be given higher priority (i.e., listed first) over the
> activeParameter specified in SignatureHelp (sig-active).

So, does this fix the problem for you?

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 816a1e67eca..51c19d5681a 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -3416,7 +3416,7 @@ eglot--sig-info
                                        'font-lock-function-name-face))))
       ;; Now to the parameters
       (cl-loop
-       with active-param = (or sig-active activeParameter)
+       with active-param = (or activeParameter sig-active)
        for i from 0 for parameter across parameters do
        (eglot--dbind ((ParameterInformation)
                       ((:label parlabel))





Added tag(s) patch. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 02 Jan 2025 01:32:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74914; Package emacs. (Sun, 05 Jan 2025 02:21:02 GMT) Full text and rfc822 format available.

Message #22 received at 74914 <at> debbugs.gnu.org (full text, mbox):

From: Troy Brown <brownts <at> troybrown.dev>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: Felician Nemeth <felician.nemeth <at> gmail.com>,
 João Távora <joaotavora <at> gmail.com>, 74914 <at> debbugs.gnu.org
Subject: Re: bug#74914: 30.0.90;
 Eglot: Incorrect parameter highlighted in signatureHelp
Date: Sat, 4 Jan 2025 21:20:42 -0500
On Sat, Dec 28, 2024 at 10:22 PM Dmitry Gutov <dmitry <at> gutov.dev> wrote:
>
> So, does this fix the problem for you?
>
> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> index 816a1e67eca..51c19d5681a 100644
> --- a/lisp/progmodes/eglot.el
> +++ b/lisp/progmodes/eglot.el
> @@ -3416,7 +3416,7 @@ eglot--sig-info
>                                          'font-lock-function-name-face))))
>         ;; Now to the parameters
>         (cl-loop
> -       with active-param = (or sig-active activeParameter)
> +       with active-param = (or activeParameter sig-active)
>          for i from 0 for parameter across parameters do
>          (eglot--dbind ((ParameterInformation)
>                         ((:label parlabel))
>

I'm not sure how the diff was created, as I couldn't get it to apply
cleanly, but yes, this change does fix the issue.




Reply sent to João Távora <joaotavora <at> gmail.com>:
You have taken responsibility. (Mon, 06 Jan 2025 10:56:02 GMT) Full text and rfc822 format available.

Notification sent to Troy Brown <brownts <at> troybrown.dev>:
bug acknowledged by developer. (Mon, 06 Jan 2025 10:56:02 GMT) Full text and rfc822 format available.

Message #27 received at 74914-done <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Troy Brown <brownts <at> troybrown.dev>, 74914-done <at> debbugs.gnu.org
Cc: Dmitry Gutov <dmitry <at> gutov.dev>,
 Felician Nemeth <felician.nemeth <at> gmail.com>
Subject: Re: bug#74914: 30.0.90;
 Eglot: Incorrect parameter highlighted in signatureHelp
Date: Mon, 6 Jan 2025 10:55:26 +0000
I pushed this patch yesterday.  Thanks everyone, closing the bug.

On Sun, Jan 5, 2025 at 2:20 AM Troy Brown <brownts <at> troybrown.dev> wrote:
>
> On Sat, Dec 28, 2024 at 10:22 PM Dmitry Gutov <dmitry <at> gutov.dev> wrote:
> >
> > So, does this fix the problem for you?
> >
> > diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> > index 816a1e67eca..51c19d5681a 100644
> > --- a/lisp/progmodes/eglot.el
> > +++ b/lisp/progmodes/eglot.el
> > @@ -3416,7 +3416,7 @@ eglot--sig-info
> >                                          'font-lock-function-name-face))))
> >         ;; Now to the parameters
> >         (cl-loop
> > -       with active-param = (or sig-active activeParameter)
> > +       with active-param = (or activeParameter sig-active)
> >          for i from 0 for parameter across parameters do
> >          (eglot--dbind ((ParameterInformation)
> >                         ((:label parlabel))
> >
>
> I'm not sure how the diff was created, as I couldn't get it to apply
> cleanly, but yes, this change does fix the issue.



-- 
João Távora




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 03 Feb 2025 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 131 days ago.

Previous Next


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