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?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#66552: 30.0.50; Eglot feature request: handle quirky code actions Date: Tue, 17 Oct 2023 04:11:28 +0100 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="7368"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66552@debbugs.gnu.org To: Richard Copley Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 17 05:12:55 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 1qsaVr-0001kN-Nf for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Oct 2023 05:12:55 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsaVc-0000dk-0X; Mon, 16 Oct 2023 23:12:40 -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 1qsaVZ-0000dZ-LZ for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2023 23:12: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 1qsaVZ-0001B2-DS for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2023 23:12:37 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qsaVy-0000hm-61 for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2023 23:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Oct 2023 03:13:02 +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.16975123362640 (code B ref 66552); Tue, 17 Oct 2023 03:13:02 +0000 Original-Received: (at 66552) by debbugs.gnu.org; 17 Oct 2023 03:12:16 +0000 Original-Received: from localhost ([127.0.0.1]:58247 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qsaVE-0000gW-Ce for submit@debbugs.gnu.org; Mon, 16 Oct 2023 23:12:16 -0400 Original-Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]:61906) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qsaV9-0000g9-Cj for 66552@debbugs.gnu.org; Mon, 16 Oct 2023 23:12:15 -0400 Original-Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-507a772ed97so3032526e87.3 for <66552@debbugs.gnu.org>; Mon, 16 Oct 2023 20:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697512300; x=1698117100; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=uGt59jWwZ3Lcftwmcgzz9gtvQB3HHgTUcWeCtRaOmzw=; b=cYJN3yiifW/n3ePY8MGxX4AZ4lhERt+ghe2ntAj/3j9DToJZxkee24b7pCoV2MXXqm cvKQHEBKJ/pwJGrSXkPOJ6LHiMsjxk+LZ2cv18PuaLLWQmjgd+J/di8t//htZYwbG/61 T5gWAwfEyOpyx5N/gtb7Bo2PkLuEUZht3p3KwtE2Rz5eQBI9uDyvpIoYkBHrrSlxzBuT ZhdpasaDaPOgIQfqLEs1576XkGelUerrxxmGyqOg1zOwrwlTRLAxj+L4NugJ7GFhXhCk ftp1kaoU/S6lXPaqzHf7yRESfDgecOrYCwMwgbhpad+FfFTOHj6Mrv8WwGVK9rxWLvEK bcFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697512300; x=1698117100; h=content-transfer-encoding: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=uGt59jWwZ3Lcftwmcgzz9gtvQB3HHgTUcWeCtRaOmzw=; b=j0NWmejwiz2F6GDYLWQ02CiLTrHwnHgva/ioL43Q/1gO9ueJMGJS7QqonUsZgshMw3 rgjJPV5yo9bA32o40y/9xaBI8MVfevHq79OMecZC4rCzrp9c71feOJccaWqu8o0VZuyl sTY0r8hG0+NyKz9dOc6rZAe5IVH2mWKi+AkIaLu95iYDoaAUr3iz6OBvQnakeTXDaOYD OHSnbPQUS2bOQ8XJW/UKb+9Xsbq6wulteFSoF7mtVwm9f7sML8VL9hkvIo4uWk34dYzN m2QKYXpYzHuFao2b6m1ljq74anlycn8VpN6Tx8RsU0CRBBubPtShsLMGh9fsnyD9gwxA g0Kg== X-Gm-Message-State: AOJu0Ywp9kk5DRgWvXBZquatp8tkY+14m+ViYROXmz4gIbzUNsxhUPJZ cX+tb/g2c7/7rlntBGh9rlx4Qr6Hvi7nkqsNFt9ehv9hjdwOlg== X-Google-Smtp-Source: AGHT+IF5cVVQhAaisZMdIK/5F57MeDpbntZZ21DZ6GHo30qLcd7AEGzq057KWnlSUeQhNW0S0v0zVvOHAjcPf+aCHC8= X-Received: by 2002:a05:6512:328b:b0:507:ae8b:a573 with SMTP id p11-20020a056512328b00b00507ae8ba573mr794400lfe.51.1697512299860; Mon, 16 Oct 2023 20:11:39 -0700 (PDT) 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:272594 Archived-At: On Sun, Oct 15, 2023 at 3:25=E2=80=AFAM 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? I understand the problem, thanks for describing it nicely. Anyway, I don't think patching this in a client like Eglot is recommended. Both these thinks are bugs in the language server and should be fixed there. Eglot is an LSP client which works with tens, maybe hundreds, of servers, it can't bloat itself to work around every server's quirks. For the version field, servers don't _have_ to send one (if I remember correctly). If a servers sends no field, Eglot will ignore it. If it sends a wrong one, Eglot won't. You could work around it with a monkey-patch by advising eglot--apply-text-edits to always have a null second argument. The second labeling problem is even more bizarre Again, you can probably monkey-patch Eglot to work around it. But I really think you should report these two things to the language server authors. Jo=C3=A3o