From: Eshel Yaron <me@eshelyaron.com>
To: "João Távora" <joaotavora@gmail.com>
Cc: Spencer Baugh <sbaugh@janestreet.com>, emacs-devel@gnu.org
Subject: Re: Adding fix suggestions to Flymake diagnostics
Date: Mon, 27 May 2024 19:40:09 +0200 [thread overview]
Message-ID: <m1cyp7rw5i.fsf@dazzs-mbp.kpn> (raw)
In-Reply-To: <CALDnm51v8-ciBZULosoL724hTvLRH3_FmK3h+9Mpgtfh+NNepQ@mail.gmail.com> ("João Távora"'s message of "Mon, 27 May 2024 15:02:52 +0100")
João Távora <joaotavora@gmail.com> writes:
> On Mon, May 27, 2024 at 1:15 PM Eshel Yaron <me@eshelyaron.com> wrote:
>
>> 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 property
> 'flymake-overlay-control', part of Flymake's generic API for adding things
> 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.
next prev parent reply other threads:[~2024-05-27 17:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-26 13:37 Adding fix suggestions to Flymake diagnostics Eshel Yaron
2024-05-26 14:38 ` João Távora
2024-05-26 15:56 ` Eshel Yaron
2024-05-26 20:24 ` João Távora
2024-05-27 12:15 ` Eshel Yaron
2024-05-27 14:02 ` João Távora
2024-05-27 17:40 ` Eshel Yaron [this message]
2024-05-27 22:03 ` João Távora
2024-05-31 7:15 ` Eshel Yaron
2024-05-31 8:55 ` João Távora
2024-06-03 18:10 ` Eshel Yaron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1cyp7rw5i.fsf@dazzs-mbp.kpn \
--to=me@eshelyaron.com \
--cc=emacs-devel@gnu.org \
--cc=joaotavora@gmail.com \
--cc=sbaugh@janestreet.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).