From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron Newsgroups: gmane.emacs.devel Subject: Re: Adding fix suggestions to Flymake diagnostics Date: Mon, 27 May 2024 19:40:09 +0200 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="20944"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Spencer Baugh , emacs-devel@gnu.org To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon May 27 19:40:38 2024 Return-path: Envelope-to: ged-emacs-devel@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 1sBeKr-00057l-Al for ged-emacs-devel@m.gmane-mx.org; Mon, 27 May 2024 19:40:37 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sBeKi-0007Fe-8m; Mon, 27 May 2024 13:40:28 -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 1sBeKY-0007CY-DX for emacs-devel@gnu.org; Mon, 27 May 2024 13:40:19 -0400 Original-Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sBeKW-00005O-8U for emacs-devel@gnu.org; Mon, 27 May 2024 13:40:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1716831612; bh=ktr3HW6gstobvNyD4KK0zld4FeXccE2UkLlRldCQJ/Q=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=WSAAeHYNsgcAi1ikCTUAzbL16j2k8Fbeyl2zjuIl5DR0OIsdS0qldmTmk2/ZMFtfJ VWs3IT1SILXHsdxHdVWm1xVjQz5HzZYzGg5FBRbGkqUk1ryrP5vkkub5hGD112v7H/ 5+qu95DumgeY24iR0MoqNDWjb3nPKh6R3FzrN5126hzygAwNRShnMABcitbNP/4wdh 6N6IY8cXQKYODi+KkpnxgMurWhDrEh8WIzlw6AcWgU1P0RkO++IYon9V0XeNYQfThg SD05bR/L0PonBGxO4ayx4q48M4w67Nba0szdt3pEGd3Bd8bRiBVfnaR91wLlV6hJKR 7ECM6djshx7UQ== In-Reply-To: (=?utf-8?Q?=22Jo=C3=A3o_T=C3=A1vora=22's?= message of "Mon, 27 May 2024 15:02:52 +0100") Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@eshelyaron.com; helo=eshelyaron.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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:319621 Archived-At: Jo=C3=A3o T=C3=A1vora writes: > On Mon, May 27, 2024 at 1:15=E2=80=AFPM Eshel Yaron w= rote: > >> for example, it could rely on some overlay property that backends >> would add to diagnostics and the UI of the new library would look >> for. If we really don't want to teach Flymake about fixes, I think >> that could work. WDYT? > > What you're describing is similar, if not exactly identical to what > happens today I'm describing/requesting a backend-agnostic UI for fixing diagnostics. What happens in Eglot today is similar in that it's one example of a UI for fixing diagnostics, but it's definitely a not generic one (i.e. usable with other backends). > 1. The overlay property you suggest exists. It is 'keymap' > 2. it's added to flymake diagnostics overlays via the diagnostic type pro= perty > 'flymake-overlay-control', part of Flymake's generic API for adding th= ings > to the overlay diagnostic. > 3. The overlay _value_ is a simple keymap mapping the '[mouse-2]' binding= to > a function. I think some users add more mappings to the keymap, which= is > bound to eglot-diagnostics-map. > 4. The function is Eglot's. It mixes UI and LSP logic, alas. > [...] > If you're suggesting to wrap all this setup in some function/macro of > newlibrary.el (the file name for your "new library") so that only the > complexity of 4.2 remains in eglot.el, then that's exactly what I'm > suggesting. More or less, yes. Except the overlay property wouldn't be keymap but something that just holds a function that produces the fix suggestion, so as not to commit to a specific UI, like the fix-function argument of flymake-make-diagnostic from my patch. And again, I'm not especially interested in simplifying Eglot: that can be a nice bonus, but it's fine IMO if Eglot ends up keeping its code while also working with the standard API. > I just note that newlibrary.el _will_ have to know about > "edit-producing diagnostics", which means knowing about edits, or at > least a way to apply them. It will likely have to require > 'refactor.el', which is where the "edit" format will live, and call on > it to present and eventually apply those edits. > > In fact, in my mind, newlibrary.el is so short that there's little > reason it shouldn't just be a small section of refactor.el. Right. We also needs to know about Flymake diagnostics and their overlays, though, so the same argument suggests putting it in Flymake, as I did in my draft implementation :) But I think that we agree on the essence, and where the code lives isn't that crucial anyway, so I don't mind moving this stuff to refactor.el or indeed to a new library if that's preferable.