From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#58777: eldoc + eglot does not highlight the function parameter the cursor is at Date: Sat, 12 Nov 2022 12:45:43 -0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10947"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58777@debbugs.gnu.org, joaotavora@gmail.com To: =?UTF-8?Q?Micha=C5=82?= Dubiel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 12 21:47:18 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1otxPJ-0002eY-Ou for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 12 Nov 2022 21:47:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otxON-00042o-NQ; Sat, 12 Nov 2022 15:46:19 -0500 Original-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 1otxOG-000406-Cy for bug-gnu-emacs@gnu.org; Sat, 12 Nov 2022 15:46:12 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1otxO6-00028P-1q for bug-gnu-emacs@gnu.org; Sat, 12 Nov 2022 15:46:11 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1otxO5-0007N7-UA for bug-gnu-emacs@gnu.org; Sat, 12 Nov 2022 15:46:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Nov 2022 20:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58777 X-GNU-PR-Package: emacs Original-Received: via spool by 58777-submit@debbugs.gnu.org id=B58777.166828595128124 (code B ref 58777); Sat, 12 Nov 2022 20:46:01 +0000 Original-Received: (at 58777) by debbugs.gnu.org; 12 Nov 2022 20:45:51 +0000 Original-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 Original-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 Original-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) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 12 Nov 2022 12:45:43 -0800 In-Reply-To: ("=?UTF-8?Q?Micha=C5=82?= Dubiel"'s message of "Tue, 25 Oct 2022 12:47:45 +0200") X-Hashcash: 1:20:221112:joaotavora@gmail.com::Y1t1VvZrZ2qiJdRm:1hc5 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:247700 Archived-At: 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))