Subject: bug#79259: closed (Re: bug#79259: [PATCH] Fix arg doc off-by-one bug of eglot signature help)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 30 Aug 2025 10:46:02 +0000

Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
79259: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79259
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#79259: [PATCH] Fix arg doc off-by-one bug of eglot signature help
From: João Távora <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: Lin Jian <[email-masked]>, [email-masked]
Date: Sat, 30 Aug 2025 11:46:42 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Eli Zaretskii <[email-masked]> writes:

> João, are you okay with the patch, given the additional information
> posted by Lin Jian?

The patch is OK in spirit, but I think it can be made simpler.

Anyway was added much ealier than
e33c0a549153fa3894f3b5e9c5e42ce07a1a68c7, in this commit:

   commit 9cedae50a27f0d0d6adee82976654d63c9f67602
   Date:   Wed Jan 9 21:09:35 2019 +0000
    
       Handle label offsets in parameterinformation
       
       At least ccls uses this.

So, I think it's more likely thatn not that we will be breaking ccls, or
at least the 2019 ccls.  Is this number 0-indexed?  Hard to say, reading
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_signatureHelp

However, if it's not 0-indexed, it is 1-indexed at most.  Therefore the
use of '1+' to _add_ to the server-supplied number definitely looks
wrong.  Though, again, it is probably wrong to accomodate exactly 2019
ccls, one of the few servers at the time that used this exotic new
feature.

Anyway, I pushed a slightly simpler fix.  I'm closing this issue.  If
the problem persists, we can reopen.

João

Subject: [PATCH] Fix arg doc off-by-one bug of eglot signature help
From: Lin Jian <[email-masked]>
To: [email-masked]
Cc: João Távora <[email-masked]>
Date: Sun, 17 Aug 2025 05:48:14 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

`parlabel' is 0-indexed.  Arguments of `substring' are also
0-indexed.  No need to add 1 to `parlabel' before passing it to
`substring'.

>From 11328dd7a9d9777700b2682a3ce568e7a268d1a0 Mon Sep 17 00:00:00 2001
From: Lin Jian <[email-masked]>
Date: Sun, 17 Aug 2025 05:03:46 +0800
Subject: [PATCH] Fix arg doc off-by-one bug of eglot signature help

* lisp/progmodes/eglot.el (eglot--sig-info): Fix argument
documentation off-by-one bug of eglot signature help.

Copyright-paperwork-exempt: yes
---
 lisp/progmodes/eglot.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 4a7c525003c..0ddcb6cd09d 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -3736,7 +3736,7 @@ for which LSP on-type-formatting should be requested."
              (insert "\n  "
                      (propertize
                       (if (stringp parlabel) parlabel
-                        (apply #'substring siglabel (mapcar #'1+ parlabel)))
+                        (apply #'substring siglabel (append parlabel nil)))
                       'face (and (eq i active-param) 'eldoc-highlight-function-argument))
                      ": " fpardoc)))))
       (buffer-string))))
-- 
2.49.0