From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Micha=C5=82?= Dubiel Newsgroups: gmane.emacs.bugs Subject: bug#58777: eldoc + eglot does not highlight the function parameter the cursor is at Date: Tue, 25 Oct 2022 12:47:45 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0000000000001d116f05ebd9a4aa" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36929"; mail-complaints-to="usenet@ciao.gmane.io" To: 58777@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 25 16:54:21 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 1onLJt-0009UR-NU for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 25 Oct 2022 16:54:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1onLJc-000453-B6; Tue, 25 Oct 2022 10:54:04 -0400 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 1onLJb-0003g2-0k for bug-gnu-emacs@gnu.org; Tue, 25 Oct 2022 10:54:03 -0400 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 1onLJa-0000E9-Oq for bug-gnu-emacs@gnu.org; Tue, 25 Oct 2022 10:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1onLJa-0003XL-JO for bug-gnu-emacs@gnu.org; Tue, 25 Oct 2022 10:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Micha=C5=82?= Dubiel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Oct 2022 14:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58777 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166670960513512 (code B ref -1); Tue, 25 Oct 2022 14:54:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Oct 2022 14:53:25 +0000 Original-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 Original-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 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 1onHTV-0003Kc-Eg for bug-gnu-emacs@gnu.org; Tue, 25 Oct 2022 06:48:02 -0400 Original-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 Original-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) 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-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 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: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246153 Archived-At: --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 LSkKCmRpZmYgLS1naXQgYS9saXNwL3Byb2dtb2Rlcy9lZ2xvdC5l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