From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#66552: 30.0.50; Eglot feature request: handle quirky code actions Date: Tue, 17 Oct 2023 02:22:38 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32923"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 To: Richard Copley , 66552@debbugs.gnu.org, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 17 01:23:54 2023 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 1qsWwC-0008Lj-3s for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Oct 2023 01:23:53 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsWvy-0007nM-DK; Mon, 16 Oct 2023 19:23:38 -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 1qsWvx-0007n7-G5 for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2023 19:23:37 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsWvx-00043y-8W for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2023 19:23:37 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qsWwL-0007NI-Uc for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2023 19:24:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Oct 2023 23:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66552 X-GNU-PR-Package: emacs Original-Received: via spool by 66552-submit@debbugs.gnu.org id=B66552.169749859828276 (code B ref 66552); Mon, 16 Oct 2023 23:24:01 +0000 Original-Received: (at 66552) by debbugs.gnu.org; 16 Oct 2023 23:23:18 +0000 Original-Received: from localhost ([127.0.0.1]:58160 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qsWve-0007Lz-C0 for submit@debbugs.gnu.org; Mon, 16 Oct 2023 19:23:18 -0400 Original-Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:59159) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qsWva-0007Le-BD for 66552@debbugs.gnu.org; Mon, 16 Oct 2023 19:23:17 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id D87FE3200923; Mon, 16 Oct 2023 19:22:42 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 16 Oct 2023 19:22:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1697498562; x=1697584962; bh=k/QMlhAAetpUoHRLU0K+WXeh+bKVUdPSJBx Ge/h/0nA=; b=rUshPSPpTeKj/FDhQTSTlnsXjp3xCZ+7U/Y5lnLMCS54BPKRJrZ rZi+mKPgFb/YfHgG2mHujdP5XJW+5EVBw3fm5DFVm2rS5prf+agftFHOzRjLlrwk lh7D6kVDAcFBLmQVTu28En3nVh7dFQeKCHMzBQthzNAPMxnFdWcRy7k3rGrF2tSU 1U800pkfgc4EnPFEcEKf2vUBcxbLR2r9xb3AYiSWOORzxMkOydPupY8ZjmMXRhzE Y5Cf4Yd7evbMX3KrdgnU7nqowscnlTrLNbkYwadZTOFhRT780bj7qBN88Zr/ggRV Iv5gAJU+GpDS/qFU4pHaQ0m+f7G3pCABzlw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1697498562; x= 1697584962; bh=k/QMlhAAetpUoHRLU0K+WXeh+bKVUdPSJBxGe/h/0nA=; b=B dnzTxQwF/LnjkJpEHBJ/LHiGFwx2c0M7TJUdUouF0hUiqweOp1A/UhF6Y5jKghAe vbjFSXSBbGHoGvus/fsQXXN/VxTw5hBvV0yGOWdd26S2mO+rENq8XT2VACgHKLcm 54gWxbD6bPFGwsaH17YyC6yRtBqCnf8pOFLYsPo+aJgEFoXXU7Un8ZQsqXbJNbZE S3Zzl8hq2ALiG1RVovQBmtr9pSXbTGKVm1zlEQU2F9hj8pnAdZY1PeyONjBRmOF+ udsk2BnkobSAZVmc9Dtt5GCcK/TcOJVN8/2DTYqF5J8muXWOhsvwLf9xaJ4Bv9PE Oq1vMX0NwKr5a7F0Y8x3w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrjedugddvudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhithhr hicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrthhtvg hrnhepvdeljeelgeehtdduvdetudfgfeejjefgleevteehvdfhffelvdfhteevhffghfeg necuffhomhgrihhnpehgihhthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 16 Oct 2023 19:22:41 -0400 (EDT) Content-Language: en-US In-Reply-To: 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:272588 Archived-At: Cc'ing Joao. On 15/10/2023 05:24, Richard Copley wrote: > The language server for Lean 4 [1] provides code actions with a couple > of features that make it difficult to apply them from within Eglot. > > [1]https://github.com/leanprover/lean4 > > Firstly, the textDocument version field has the value 0, which is > generally not equal to the version in `eglot--versioned-identifier', > resulting in the error "Edits on `%s' require version %d, you have %d" > from `eglot--apply-text-edits'. > > Secondly, all the suggestions have the same title ("Apply 'Try this'"), > which means an alist using the title as the key can't be used in > completing-read as in `eglot--read-execute-code-action'. > > Could you provide options to ignore the version, and to use the newText > (JSONPath $.result[:1].edit.documentChanges[:1].edits[:1].newText) > instead of the title? > > Here is an example request and reply. The reply is cut down from an > original list of over 200 suggestions. > > [client-request] > (:jsonrpc "2.0" :id 777 :method "textDocument/codeAction" :params > (:textDocument > (:uri"file:///s%3A/projects/lean/float/Fl/Lemmas.lean") :range > (:start (:line 50 :character 2) :end (:line 50 :character 8)) > :context (:diagnostics []))) > > [server-reply] > (:result > [(:title "Apply 'Try this'" :kind "quickfix" :isPreferred t :edit > (:documentChanges > [(:textDocument > (:version 0 :uri"file:///s%3A/Fl/Lemmas.lean") > :edits > [(:range > (:start (:line 50 :character 2) :end (:line 50 :character 8)) > :newText "refine Nat.add_left_cancel ?_")])] > :changes nil :changeAnnotations nil)) > (:title "Apply 'Try this'" :kind "quickfix" :isPreferred t :edit > (:documentChanges > [(:textDocument > (:version 0 :uri"file:///s%3A/Fl/Lemmas.lean") > :edits > [(:range > (:start (:line 50 :character 2) :end (:line 50 :character 8)) > :newText "refine Nat.add_right_cancel ?_")])] > :changes nil :changeAnnotations nil)) > (:title "Apply 'Try this'" :kind "quickfix" :isPreferred t :edit > (:documentChanges > [(:textDocument > (:version 0 :uri"file:///s%3A/Fl/Lemmas.lean") > :edits > [(:range > (:start (:line 50 :character 2) :end (:line 50 :character 8)) > :newText "refine Nat.eq_of_mul_eq_mul_right ?_")])] > :changes nil :changeAnnotations nil)) > (:title "Apply 'Try this'" :kind "quickfix" :isPreferred t :edit > (:documentChanges > [(:textDocument > (:version 0 :uri"file:///s%3A/Fl/Lemmas.lean") > :edits > [(:range > (:start (:line 50 :character 2) :end (:line 50 :character 8)) > :newText "refine Nat.eq_of_mul_eq_mul_left ?_")])] > :changes nil :changeAnnotations nil))] > :jsonrpc "2.0" :id 777)