From unknown Wed Jun 18 00:27:11 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#58777 <58777@debbugs.gnu.org> To: bug#58777 <58777@debbugs.gnu.org> Subject: Status: eldoc + eglot does not highlight the function parameter the cursor is at Reply-To: bug#58777 <58777@debbugs.gnu.org> Date: Wed, 18 Jun 2025 07:27:11 +0000 retitle 58777 eldoc + eglot does not highlight the function parameter the c= ursor is at reassign 58777 emacs submitter 58777 Micha=C5=82 Dubiel severity 58777 normal tag 58777 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 25 10:53:24 2022 Received: (at submit) by debbugs.gnu.org; 25 Oct 2022 14:53:25 +0000 Received: from localhost ([127.0.0.1]:52037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1onLIy-0003Vk-DL for submit@debbugs.gnu.org; Tue, 25 Oct 2022 10:53:24 -0400 Received: from lists.gnu.org ([209.51.188.17]:49944) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1onHTX-0000yl-0g for submit@debbugs.gnu.org; Tue, 25 Oct 2022 06:48:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1onHTV-0003Kc-Eg for bug-gnu-emacs@gnu.org; Tue, 25 Oct 2022 06:48:02 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1onHTT-0004cE-Ki for bug-gnu-emacs@gnu.org; Tue, 25 Oct 2022 06:48:01 -0400 Received: by mail-ej1-x62a.google.com with SMTP id q9so11550744ejd.0 for ; Tue, 25 Oct 2022 03:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=RmwpR/p0zbq+FJa2ch0kEHw2it7BCRvYdM/oOT4rKlQ=; b=bffqogSfgZf3rZCyfYlwd4NyPjmnJdN+CoENhiVW/uaL0/FfmY8jLy28wXpQMLc5PX 7rlxkynjO+f/dlVq/8EdjQChufxPPRs9UqBMIQW7wpWk2gF1ZfUd/uec6czjSWJvuMBD geqDoNLQBaZFNgH3bxc1SXyUTKtqjx3UndXaxIKz1KyhBDZPKnbI3sOj5Em/WU8wpIXB qMiRes8iwgt1EG+6ywq4X9Pcyz7SzMnyK/ef2j+0IceeRfBiw9fpUnvHfka9wbqz2/ll ydaplpbuYhsRfkXo9qaz4q6ZdJ/QOWM0y8T551Q1nVWsUK5U0o9HARIX3jJ/CxHOgCkj maNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=RmwpR/p0zbq+FJa2ch0kEHw2it7BCRvYdM/oOT4rKlQ=; b=GtGjqC46iQpSCuUJnoHDJ+WHJArZn2YSuOllraxp5Zaw4G8Sxudq65osSA7dlt5G91 sFZtdtqqphUG1HQhsuTUQcXg26mDG7p9p695fB5HUo/QlsohzVijmzSUiNe//6h94oIC Jg5lwop2g609sPvG4N6GB7/oiwqi9Ak7U6aFEdrFIe2S2cswkaVNHlGC4z+OIio/RpIp 6bfBDkgYlxqTsXNgPqeCP4CZrTer90Ya2nFBPB4FE6Zh/tWEvZnA0te++pEhd4JXP5hI LAu5RqhkV5btONq1oaOeM0edfxbyjrW4aHdajotHZkDpPHPGYQXFb70w+uh7gi0lkfCi lhMQ== X-Gm-Message-State: ACrzQf2xao3vpjk4vWUbHBNUQRMVZJOBcaZ5Bg8G1vvUD0xKXA1t/KzF Vq4tki8ELyfGw2dC4gZ29xL/MdDSqSIOQJSehjilUMaCSxs= X-Google-Smtp-Source: AMsMyM6dDpM+oFXQES2C0B5l5SEzBC2DYsB2Tv5onRUUXb/mgSgVcGfMqJ+8Lrrs/uO/PcTz9UOyqzDnB/Fl+76+3vI= X-Received: by 2002:a17:907:a067:b0:7a7:dc5e:eb2d with SMTP id ia7-20020a170907a06700b007a7dc5eeb2dmr9044177ejc.121.1666694877328; Tue, 25 Oct 2022 03:47:57 -0700 (PDT) MIME-Version: 1.0 From: =?UTF-8?Q?Micha=C5=82_Dubiel?= Date: Tue, 25 Oct 2022 12:47:45 +0200 Message-ID: Subject: eldoc + eglot does not highlight the function parameter the cursor is at To: bug-gnu-emacs@gnu.org Content-Type: multipart/mixed; boundary="0000000000001d116f05ebd9a4aa" Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=majkijin@gmail.com; helo=mail-ej1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 25 Oct 2022 10:53:20 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --0000000000001d116f05ebd9a4aa Content-Type: text/plain; charset="UTF-8" Hi, I have noticed an issue with highlighting the function parameters by eldoc when using eglot + pyright python LSP server (version 1.1.276). Assume this very simple python code: ``` def function(arg1, arg2, arg3): pass function(1, 2, 3) ``` If the cursor is placed at any of the arguments of the function call statement, eldoc does not highlight the argument the cursor is currently at. This happens because pyright does not include the function name in the returned signature help label when the cursor is inside the parentheses, i.e (cursor denoted as |) : 1. For fun|ction(arg1, arg2, arg3), the returned signature label from pyright is: (function) function: (arg1: Unknown, arg2: Unknown, arg3: Unknown) -> None 2. For function(1|, 2, 3) (please notice the cursor is at arg1): (arg1: Unknown, arg2: Unknown, arg3: Unknown) -> None Because in case 2 there is no function name but only the arguments inside the parenthesis, the eglot's `eglot--sig-info' function fails to parse the label correctly and mark the `params-start' and `params-end' variables. I believe a simple fix for this is to change the regexp pattern used for finding the arguments in the function signature label as in the attached patch. It ensures that the parameters are found regardless of whether the function name was included in the signature label or not. Regards, Michal --0000000000001d116f05ebd9a4aa Content-Type: text/x-patch; charset="US-ASCII"; name="0001-eglot-Support-signature-labels-without-a-function-na.patch" Content-Disposition: attachment; filename="0001-eglot-Support-signature-labels-without-a-function-na.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l9o2tv4e0 RnJvbSBlOWNlYmNkOWFlZDdkOTJiZDJlYTBiNjkyMTY1ZTViNTVhZGY4MDg0IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBNaWNoYWwgRHViaWVsIDxtYWpraWppbkBnbWFpbC5jb20+CkRh dGU6IFN1biwgMjMgT2N0IDIwMjIgMTk6NTQ6MzEgKzAyMDAKU3ViamVjdDogW1BBVENIXSBlZ2xv dDogU3VwcG9ydCBzaWduYXR1cmUgbGFiZWxzIHdpdGhvdXQgYSBmdW5jdGlvbiBuYW1lCgoqIGxp c3AvcHJvZ21vZGVzL2VnbG90LmVsIChlZ2xvdC0tc2lnLWluZm8pOiBTdXBwb3J0IHNpZ25hdHVy ZSBsYWJlbHMKd2l0aG91dCBhIGZ1bmN0aW9uIG5hbWUuCi0tLQogbGlzcC9wcm9nbW9kZXMvZWds b3QuZWwgfCAyICstCiAxIGZpbGUgY2hhbmdlZCwgMSBpbnNlcnRpb24oKyksIDEgZGVsZXRpb24o LSkKCmRpZmYgLS1naXQgYS9saXNwL3Byb2dtb2Rlcy9lZ2xvdC5lbCBiL2xpc3AvcHJvZ21vZGVz L2VnbG90LmVsCmluZGV4IDcxMDAxYmE2ODAuLmY1YTAwYjAzYzcgMTAwNjQ0Ci0tLSBhL2xpc3Av cHJvZ21vZGVzL2VnbG90LmVsCisrKyBiL2xpc3AvcHJvZ21vZGVzL2VnbG90LmVsCkBAIC0yOTA5 LDcgKzI5MDksNyBAQCBmb3Igd2hpY2ggTFNQIG9uLXR5cGUtZm9ybWF0dGluZyBzaG91bGQgYmUg cmVxdWVzdGVkLiIKICAgICAgICAobGV0ICgoYWN0aXZlLXBhcmFtIChvciBhY3RpdmVQYXJhbWV0 ZXIgc2lnLWhlbHAtYWN0aXZlLXBhcmFtKSkKICAgICAgICAgICAgICBwYXJhbXMtc3RhcnQgcGFy YW1zLWVuZCkKICAgICAgICAgIDs7IEFkLWhvYyBhdHRlbXB0IHRvIHBhcnNlIGxhYmVsIGFzIDxu YW1lPig8cGFyYW1zPikKLSAgICAgICAgICh3aGVuIChsb29raW5nLWF0ICJcXChbXihdK1xcKShc XChbXildK1xcKSkiKQorICAgICAgICAgKHdoZW4gKGxvb2tpbmctYXQgIlxcKFteKF0qXFwpKFxc KFteKV0rXFwpKSIpCiAgICAgICAgICAgIChzZXRxIHBhcmFtcy1zdGFydCAobWF0Y2gtYmVnaW5u aW5nIDIpIHBhcmFtcy1lbmQgKG1hdGNoLWVuZCAyKSkKICAgICAgICAgICAgKGFkZC1mYWNlLXRl eHQtcHJvcGVydHkgKG1hdGNoLWJlZ2lubmluZyAxKSAobWF0Y2gtZW5kIDEpCiAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICdmb250LWxvY2stZnVuY3Rpb24tbmFtZS1mYWNlKSkK LS0gCjIuMzQuMQoK --0000000000001d116f05ebd9a4aa-- From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 12 15:45:51 2022 Received: (at 58777) by debbugs.gnu.org; 12 Nov 2022 20:45:51 +0000 Received: from localhost ([127.0.0.1]:49237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otxNu-0007JR-IU for submit@debbugs.gnu.org; Sat, 12 Nov 2022 15:45:51 -0500 Received: from mail-oa1-f53.google.com ([209.85.160.53]:37790) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otxNt-0007Bw-DQ for 58777@debbugs.gnu.org; Sat, 12 Nov 2022 15:45:49 -0500 Received: by mail-oa1-f53.google.com with SMTP id 586e51a60fabf-12c8312131fso8822201fac.4 for <58777@debbugs.gnu.org>; Sat, 12 Nov 2022 12:45:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=ooqoaxbegKAaheb1fC27zUPbllqIDwU/Y1X92WRzxnY=; b=H9npK3dF8oW7Abps8ZmN3ukftdCjmfKg82N0CIdUxrGXGVUJETWOxLUAdwAxs/1ZGk vDvUH+rLcKYUhc2zGWISlFuXhAcxGeL08ipZ8nCO/HJDy2xLY/zDEil3XSOQ+ytnFtf0 cGQLKPzNOlnfh9oVVksSfmsZMUgRXEaGiv8eMWnZVu337Px/ynOQxouIXBL1bXk62p3h 0+p0S0URbESBKVANMxRohjZqQ9WGTiGrgEOKdqsqmu0m071W05wkkatU+E+hOsvRKc2J MNQR6VwT2X2uzg2wtMXDOPq4BU83wQwtey+c790fnJpuJcWPRiStT8JImHw8om1qxlc5 8uNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ooqoaxbegKAaheb1fC27zUPbllqIDwU/Y1X92WRzxnY=; b=kElcQrWIue3nNotxDUWdCa781jys7kVu/nb6u+O22+brRDCBCCnoOHIcU2DVnrtsWP J+i9uZOJ+7ecVzpGa3O6zVmgE6coYKQeTiKyYaPdb4cAcrprnQGskoSJxJ0jcODyLaRO pvc51jgzm4q/SIuS2pfoTTA1fS3groCVWZm9ZSTWUWrZ1FnZB7FzuAM7UZha2DNZYza2 Bpq7bknYVlma6L1WcgDN7P8ErQPGON6YIUflPKz+cz5fUfUCVfl/s/n2EQrLxLxVB6YU Y3PggKgQyUmd4Xudm9fc02OKQD3Y2toGx6E7STwe7BwOmdMjkqsDrO+iNo/Z1CqD953r aCNg== X-Gm-Message-State: ANoB5pmm9vxW4ftg9cvGNxSC4aLX+PH/NYVJzkifq7oz54sC/VfYQAfV qnNG5eojOzWAFZeFtIoaCp1rpYMGE86eRZxNz/kpRSPF X-Google-Smtp-Source: AA0mqf58HoQROz01C7CPbaO6CXxpCajrMPMw9mdsFk3h7ts6/Qt5wb6ytkb6qwHJE49oTs11nuKkG6RgS/rUsMWXaFk= X-Received: by 2002:a05:6870:6c15:b0:13b:8a07:2a1f with SMTP id na21-20020a0568706c1500b0013b8a072a1fmr3975473oab.199.1668285944071; Sat, 12 Nov 2022 12:45:44 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 12 Nov 2022 12:45:43 -0800 From: Stefan Kangas In-Reply-To: =?UTF-8?Q?=3CCAJoCi65dQuDa9pUpk9FHtSvyUGsesyU6Bhh=3DpdVm7onXZx?= =?UTF-8?Q?tZTA=40mail=2Egmail=2Ecom=3E_=28=22Micha=C5=82_Dubiel=22=27s_message_of_=22Tue=2C_25?= =?UTF-8?Q?_Oct_2022_12=3A47=3A45_=2B0200=22=29?= References: X-Hashcash: 1:20:221112:joaotavora@gmail.com::Y1t1VvZrZ2qiJdRm:1hc5 MIME-Version: 1.0 Date: Sat, 12 Nov 2022 12:45:43 -0800 Message-ID: Subject: Re: bug#58777: eldoc + eglot does not highlight the function parameter the cursor is at To: =?UTF-8?Q?Micha=C5=82_Dubiel?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 58777 Cc: 58777@debbugs.gnu.org, joaotavora@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Copying in Jo=C3=A3o; please see the below patch. Micha=C5=82 Dubiel writes: > Hi, > > I have noticed an issue with highlighting the function parameters by > eldoc when using eglot + pyright python LSP server (version 1.1.276). > Assume this very simple python code: > ``` > def function(arg1, arg2, arg3): > pass > > function(1, 2, 3) > ``` > > If the cursor is placed at any of the arguments of the function call > statement, eldoc does not highlight the argument the cursor is > currently at. > > This happens because pyright does not include the function name in the > returned signature help label when the cursor is inside the > parentheses, i.e (cursor denoted as |) : > 1. For fun|ction(arg1, arg2, arg3), the returned signature label from > pyright is: > (function) function: (arg1: Unknown, arg2: Unknown, arg3: Unknown) -> Non= e > > 2. For function(1|, 2, 3) (please notice the cursor is at arg1): > (arg1: Unknown, arg2: Unknown, arg3: Unknown) -> None > > Because in case 2 there is no function name but only the arguments > inside the parenthesis, the eglot's `eglot--sig-info' function fails > to parse the label correctly and mark the `params-start' and > `params-end' variables. > > I believe a simple fix for this is to change the regexp pattern used > for finding the arguments in the function signature label as in the > attached patch. It ensures that the parameters are found regardless of > whether the function name was included in the signature label or not. > > Regards, > Michal > > From e9cebcd9aed7d92bd2ea0b692165e5b55adf8084 Mon Sep 17 00:00:00 2001 > From: Michal Dubiel > Date: Sun, 23 Oct 2022 19:54:31 +0200 > Subject: [PATCH] eglot: Support signature labels without a function name > > * lisp/progmodes/eglot.el (eglot--sig-info): Support signature labels > without a function name. > --- > 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 71001ba680..f5a00b03c7 100644 > --- a/lisp/progmodes/eglot.el > +++ b/lisp/progmodes/eglot.el > @@ -2909,7 +2909,7 @@ for which LSP on-type-formatting should be requeste= d." > (let ((active-param (or activeParameter sig-help-active-param)) > params-start params-end) > ;; Ad-hoc attempt to parse label as () > - (when (looking-at "\\([^(]+\\)(\\([^)]+\\))") > + (when (looking-at "\\([^(]*\\)(\\([^)]+\\))") > (setq params-start (match-beginning 2) params-end (match-end = 2)) > (add-face-text-property (match-beginning 1) (match-end 1) > 'font-lock-function-name-face)) From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 12 15:45:22 2022 Received: (at control) by debbugs.gnu.org; 12 Nov 2022 20:45:22 +0000 Received: from localhost ([127.0.0.1]:49213 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otxNS-0006FN-9U for submit@debbugs.gnu.org; Sat, 12 Nov 2022 15:45:22 -0500 Received: from mail-oi1-f174.google.com ([209.85.167.174]:37719) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otxNQ-0005oM-Dc for control@debbugs.gnu.org; Sat, 12 Nov 2022 15:45:20 -0500 Received: by mail-oi1-f174.google.com with SMTP id b124so7988544oia.4 for ; Sat, 12 Nov 2022 12:45:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=W7uoYRfHeMXa57po9EV0S6wtwaayhamti4n498S9Byg=; b=lZMnwFGKJG1bCVKvlArPjZA1LAtIXqGa4kpkYtxuGLn0EEdVhoJWapManE1nG6BaFZ 7tLWRHPKXXOjAAGGgQejI02HAQeHiHIDyERuZ0uyLYy1DiENhX+zbVr8eIVpBHVkVcqw B6lXQLjtv8qBRsIdLZVep2Nt7Nux/yJ4XHm70Sf3uY+JFiXrth92rblpQob7+boGghzC XL0otqvA85Y7u3X7CrkQzGqcyK7XtR1ZuylY28zDUOj1Y+GQg/jGqUBzsytD7Xd+Lh8w mghNq/SgmfYCY1KLsLaLh/b3KGnmB36Chr7q5wvd8qp+iBIFpHeiLE9J+aCLnkpgMLUf tjXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=W7uoYRfHeMXa57po9EV0S6wtwaayhamti4n498S9Byg=; b=MhxPxlAvTRvxm5O1uU2Yb4ZcaEfhVNbNiL6S0so0v9HIOcMCHXcl6MFoLDzNP9Nt1g HEgKVwvfkgFUpy3FWuRm7/R6WTWZFLMfNGKkP6SqGJt7G5RK4sJ27DDqt35WeKyz0z5C YBtdUDJ2dBSZsIlLMcms1NCsM17CVl23MLTdwGlD/cU9KBGn9Icw97dYnRhOQsxaBChA TDSFSPd/YnereTCSgTu51uKADMFS7xS3wYahPdAFXcLO4UU+1pWKQWYO3MVi06aqhv3f caFhK9SKK4IURIuaCvXw4HISfF/w7GZ5+uiNOKBg180VaHStivEj1JnoQrKvPS6rQaMl bN9w== X-Gm-Message-State: ANoB5pn9POTYesaNQraebKzXctjhvkixBujjmqLqJqdVftbQxfZAxfx0 cxVPRcYjUVpycskRw/uXOkwkERGu4Laljj87KnRrtQL8 X-Google-Smtp-Source: AA0mqf4qdCxDlTauOwd6KKN8j3zWp+VcSPiUjwEpWrn5bewsO6BDwhUvpkVhIvM9Z4Cn3oCNHfTZlplREOPO9FLwrp8= X-Received: by 2002:a54:4889:0:b0:359:dc32:4f9e with SMTP id r9-20020a544889000000b00359dc324f9emr3176960oic.92.1668285914951; Sat, 12 Nov 2022 12:45:14 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 12 Nov 2022 12:45:14 -0800 From: Stefan Kangas X-Hashcash: 1:20:221112:control@debbugs.gnu.org::ZJpNXZAUh7Pq2irh:0AXT MIME-Version: 1.0 Date: Sat, 12 Nov 2022 12:45:14 -0800 Message-ID: Subject: control message for bug #58777 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 58777 + patch quit From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 12 16:13:07 2022 Received: (at 58777) by debbugs.gnu.org; 12 Nov 2022 21:13:07 +0000 Received: from localhost ([127.0.0.1]:49452 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otxoJ-00027K-18 for submit@debbugs.gnu.org; Sat, 12 Nov 2022 16:13:07 -0500 Received: from mail-oa1-f43.google.com ([209.85.160.43]:46726) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otxoG-00026T-Hg for 58777@debbugs.gnu.org; Sat, 12 Nov 2022 16:13:05 -0500 Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-13b6c1c89bdso8815707fac.13 for <58777@debbugs.gnu.org>; Sat, 12 Nov 2022 13:13:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=pFTAUPrTys4oD1ZODtvJqQKKA9W84nXD/1k+ZfUQnQk=; b=Z0pk8KtI/gGneo2NJea0VyEpuljydeXoKjLFajsASI5zRuKlkmQ7N+ftAph5aj6927 RsuQc0/rReAdrwnhK/P4nCROWnDaRbvG3b0KqG+CDwzCROC0ChZBYXDWZo0mNnk4eOLl tE1I2dKRfysXKEPuI4WxpDWmFpQJGyP+sscLgxc4BHvMvo7rw/TaWIBmjSRfa5Bt3HdT 04RyPdZGva5r638eED9eAREroXojJR5m54lhzyAEn7MFSTa/bkFoG6U42lXQvx3t2Ftt S81CdiILyl5IEObqC5Iu2io8bD/SI63L1pg2uhcMNtfGc//+hmnHmzCateACKKBQSfsP BoXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pFTAUPrTys4oD1ZODtvJqQKKA9W84nXD/1k+ZfUQnQk=; b=BHzbfjTUW0iQmVNq1+blDmLmLJLYlwjstwOvBuy5g4PHb1YcHcV/SB2dAgdF1/J3hg 1OGM6SjKjmdFaOk7OBOAFDIbykXLWfP1RRAGnoTpWNqARvhpeMs+46ZYwNaROgMDVzzm a5ZWAMT2SpWqelv/Wg/4Wy1USDtN9URWa2EqMg+ZyEU9W/gbvy3TZ4JmJqkudJBYi48o OBXsSNdc4INhpsoLHZTROS9XHBE9dxRDZjvl5XZl0/u1JA2uX0mzkeJ1GQLQU+waA0va uiOQIuPTwi+E0paOt1GjvokAiyuqImI3P2X5ljTe2eA3n6cCPvyMFZXHyEo84ZssQKIN 6Qkw== X-Gm-Message-State: ANoB5plBapctr4/axAOdDJjV+kg0N3NQRmqraF/1LeXojVo8BzMt72pk AvXBCfAEcwsaOckcYJZS1TVeP3nKUiuAdV7ZDBioqPK9 X-Google-Smtp-Source: AA0mqf6Rcn54tzup/XYHxSvlZV/ovVkrdHj2OtqEwRt482bFwtgBOBQomiPDd1suqVqosg9h91/58n2BzztfLNrP/XE= X-Received: by 2002:a05:6870:9f13:b0:13b:5ffe:ff70 with SMTP id xl19-20020a0568709f1300b0013b5ffeff70mr3818618oab.171.1668287579169; Sat, 12 Nov 2022 13:12:59 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Sat, 12 Nov 2022 21:12:46 +0000 Message-ID: Subject: Re: bug#58777: eldoc + eglot does not highlight the function parameter the cursor is at To: Stefan Kangas Content-Type: multipart/alternative; boundary="0000000000008a26bf05ed4c788e" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 58777 Cc: 58777@debbugs.gnu.org, =?UTF-8?Q?Micha=C5=82_Dubiel?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000008a26bf05ed4c788e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I'd say this looks good. It would be even better with a couple of automated tests, but then again eglot-tests.el hasn't migrated to Emacs yet. Jo=C3=A3o On Sat, Nov 12, 2022, 20:45 Stefan Kangas wrote: > Copying in Jo=C3=A3o; please see the below patch. > > Micha=C5=82 Dubiel writes: > > > Hi, > > > > I have noticed an issue with highlighting the function parameters by > > eldoc when using eglot + pyright python LSP server (version 1.1.276). > > Assume this very simple python code: > > ``` > > def function(arg1, arg2, arg3): > > pass > > > > function(1, 2, 3) > > ``` > > > > If the cursor is placed at any of the arguments of the function call > > statement, eldoc does not highlight the argument the cursor is > > currently at. > > > > This happens because pyright does not include the function name in the > > returned signature help label when the cursor is inside the > > parentheses, i.e (cursor denoted as |) : > > 1. For fun|ction(arg1, arg2, arg3), the returned signature label from > > pyright is: > > (function) function: (arg1: Unknown, arg2: Unknown, arg3: Unknown) -> > None > > > > 2. For function(1|, 2, 3) (please notice the cursor is at arg1): > > (arg1: Unknown, arg2: Unknown, arg3: Unknown) -> None > > > > Because in case 2 there is no function name but only the arguments > > inside the parenthesis, the eglot's `eglot--sig-info' function fails > > to parse the label correctly and mark the `params-start' and > > `params-end' variables. > > > > I believe a simple fix for this is to change the regexp pattern used > > for finding the arguments in the function signature label as in the > > attached patch. It ensures that the parameters are found regardless of > > whether the function name was included in the signature label or not. > > > > Regards, > > Michal > > > > From e9cebcd9aed7d92bd2ea0b692165e5b55adf8084 Mon Sep 17 00:00:00 2001 > > From: Michal Dubiel > > Date: Sun, 23 Oct 2022 19:54:31 +0200 > > Subject: [PATCH] eglot: Support signature labels without a function nam= e > > > > * lisp/progmodes/eglot.el (eglot--sig-info): Support signature labels > > without a function name. > > --- > > 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 71001ba680..f5a00b03c7 100644 > > --- a/lisp/progmodes/eglot.el > > +++ b/lisp/progmodes/eglot.el > > @@ -2909,7 +2909,7 @@ for which LSP on-type-formatting should be > requested." > > (let ((active-param (or activeParameter sig-help-active-param)) > > params-start params-end) > > ;; Ad-hoc attempt to parse label as () > > - (when (looking-at "\\([^(]+\\)(\\([^)]+\\))") > > + (when (looking-at "\\([^(]*\\)(\\([^)]+\\))") > > (setq params-start (match-beginning 2) params-end (match-en= d > 2)) > > (add-face-text-property (match-beginning 1) (match-end 1) > > 'font-lock-function-name-face)) > --0000000000008a26bf05ed4c788e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I'd say this looks good. It would be even better= with a couple of automated tests, but then again eglot-tests.el hasn't= migrated to Emacs yet.

= Jo=C3=A3o

On Sat, Nov 12, 2022, 20:45 Stefan Kangas <stefankangas@gmail.com> wrote:
Copying in Jo=C3=A3o; please see the = below patch.

Micha=C5=82 Dubiel <majkijin@gmail.com> writes:

> Hi,
>
> I have noticed an issue with highlighting the function parameters by > eldoc when using eglot + pyright python LSP server (version 1.1.276).<= br> > Assume this very simple python code:
> ```
> def function(arg1, arg2, arg3):
>=C2=A0 =C2=A0 =C2=A0pass
>
> function(1, 2, 3)
> ```
>
> If the cursor is placed at any of the arguments of the function call > statement, eldoc does not highlight the argument the cursor is
> currently at.
>
> This happens because pyright does not include the function name in the=
> returned signature help label when the cursor is inside the
> parentheses, i.e (cursor denoted as |) :
> 1. For fun|ction(arg1, arg2, arg3), the returned signature label from<= br> > pyright is:
> (function) function: (arg1: Unknown, arg2: Unknown, arg3: Unknown) -&g= t; None
>
> 2. For function(1|, 2, 3) (please notice the cursor is at arg1):
> (arg1: Unknown, arg2: Unknown, arg3: Unknown) -> None
>
> Because in case 2 there is no function name but only the arguments
> inside the parenthesis, the eglot's `eglot--sig-info' function= fails
> to parse the label correctly and mark the `params-start' and
> `params-end' variables.
>
> I believe a simple fix for this is to change the regexp pattern used > for finding the arguments in the function signature label as in the > attached patch. It ensures that the parameters are found regardless of=
> whether the function name was included in the signature label or not.<= br> >
> Regards,
> Michal
>
> From e9cebcd9aed7d92bd2ea0b692165e5b55adf8084 Mon Sep 17 00:00:00 2001=
> From: Michal Dubiel <majkijin@gmail.com>
> Date: Sun, 23 Oct 2022 19:54:31 +0200
> Subject: [PATCH] eglot: Support signature labels without a function na= me
>
> * lisp/progmodes/eglot.el (eglot--sig-info): Support signature labels<= br> > without a function name.
> ---
>=C2=A0 lisp/progmodes/eglot.el | 2 +-
>=C2=A0 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> index 71001ba680..f5a00b03c7 100644
> --- a/lisp/progmodes/eglot.el
> +++ b/lisp/progmodes/eglot.el
> @@ -2909,7 +2909,7 @@ for which LSP on-type-formatting should be reque= sted."
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(let ((active-param (or activeParamet= er sig-help-active-param))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0params-start par= ams-end)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; Ad-hoc attempt to parse lab= el as <name>(<params>)
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when (looking-at "\\([^(]+\\)= (\\([^)]+\\))")
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when (looking-at "\\([^(]*\\)= (\\([^)]+\\))")
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq params-start (mat= ch-beginning 2) params-end (match-end 2))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(add-face-text-property= (match-beginning 1) (match-end 1)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'font-loc= k-function-name-face))
--0000000000008a26bf05ed4c788e-- From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 12 16:34:48 2022 Received: (at 58777) by debbugs.gnu.org; 12 Nov 2022 21:34:48 +0000 Received: from localhost ([127.0.0.1]:49474 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oty9H-0004qs-Rw for submit@debbugs.gnu.org; Sat, 12 Nov 2022 16:34:48 -0500 Received: from mail-ot1-f44.google.com ([209.85.210.44]:35487) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oty9E-0004qQ-FX for 58777@debbugs.gnu.org; Sat, 12 Nov 2022 16:34:45 -0500 Received: by mail-ot1-f44.google.com with SMTP id cn2-20020a056830658200b0066c74617e3dso4683631otb.2 for <58777@debbugs.gnu.org>; Sat, 12 Nov 2022 13:34:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=A+o0Qu1LmobYkLY/bDrXZ+YFxUETRdvp6REH7Vf2Ya0=; b=ozTnz5s0dYc7Ggo3+3s2tvo70a85bqiDMKSKn3AAR33u/veLHQoMs5CVGGDG7tdpFB LfAxNIqjAN+yg0uYXfpgYQJeYklLuGa8cqoj8gfXc5/sKfszYNO2497bxug9T+WLNFM0 OV8V9Ijp2UgXVER+Zp567OcV+ybQWagUOUp7q5EHktbUWKZdBQfbmCRtYvP98QvPUpAG 4q+zjnm5gQvGawZWw5/ZqVZP05+H7ueBaP+/KFk8zYwae305coNWYwKRuq2tLjMGzScS Gog+2Z8m87xzTT+0cmTlWctPuffl2rRGzFs0Yp4gQ2trmrNVpThL1p/QXdNpH4Xx4sTg QRZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=A+o0Qu1LmobYkLY/bDrXZ+YFxUETRdvp6REH7Vf2Ya0=; b=X579mYHfVtqeptRfgZAbsbOS/h4+nuNllDKIQ/17RI6sQ9hae6rW4oVMU2W3Na8rm9 CIBPoKbk180wNk7L+nw0oOBA11/OLeelxVzA0jWkgNjhl8Zl7B5Cor+jBwL7WkJFsvD4 aTJwExU97sjkzYABtgPEpiiJ9VE0EzQCPIQOr4SW9co6QkJs/OjfsSECCLzeypN7OGRx PywXSiSdIl0cMIrPyk+ZTWeEzn1RGQGSAo1CH9+KPBjGGxU/qMWuwWsId+gzb0LlRMNs wOgEPg5dUE24xaC9EhD2/V5rkjSvKCNrVgDbWoefbComWpCAFEtqRKir9Viu5qkIoxVZ NTfQ== X-Gm-Message-State: ANoB5plzaUXGtKIHFD4LrXkOLfFDIraKxJd4VhO+89okB+ywN4yWRa6Z wFH8VNhAleGqyHn9r8+Wctag9xkEboBcDc+/qbA= X-Google-Smtp-Source: AA0mqf6jCQHsD+Pjg5tuBR7ltYEuXMHzOtQaRwv58UafWuYaIFMGRps7jYA6uju1XrrlkWGNMxmRNl8PBenRco7eNjc= X-Received: by 2002:a9d:4f10:0:b0:66c:5232:b9d1 with SMTP id d16-20020a9d4f10000000b0066c5232b9d1mr3774752otl.224.1668288878580; Sat, 12 Nov 2022 13:34:38 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 12 Nov 2022 13:34:38 -0800 From: Stefan Kangas In-Reply-To: References: X-Hashcash: 1:20:221112:58777@debbugs.gnu.org::58xGDFl02V+1/f42:15DB MIME-Version: 1.0 Date: Sat, 12 Nov 2022 13:34:38 -0800 Message-ID: Subject: Re: bug#58777: eldoc + eglot does not highlight the function parameter the cursor is at To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 58777 Cc: 58777@debbugs.gnu.org, =?UTF-8?Q?Micha=C5=82_Dubiel?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) close 58777 29.1 thanks Jo=C3=A3o T=C3=A1vora writes: > I'd say this looks good. It would be even better with a couple of automat= ed > tests, but then again eglot-tests.el hasn't migrated to Emacs yet. OK, pushed to master (commit 9d334f558a). From unknown Wed Jun 18 00:27:11 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 11 Dec 2022 12:24:13 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator