all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
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 14:15:27 +0200	[thread overview]
Message-ID: <m17cffxxgg.fsf@dazzs-mbp.kpn> (raw)
In-Reply-To: <CALDnm52u4wPB4SKWsnDror1WYUAbsJ3+0vqOhGzS6qHwr8aoYw@mail.gmail.com> ("João Távora"'s message of "Sun, 26 May 2024 21:24:52 +0100")

Hi João,

João Távora <joaotavora@gmail.com> writes:

> On Sun, May 26, 2024 at 4:56 PM Eshel Yaron <me@eshelyaron.com> wrote:
>>
>> Yes, Flymake lets backends associate arbitrary overlay properties with
>> diagnostics, but that requires backends to worry about UI stuff.
>
> 100% Agree.  And indeed Eglot would like not to worry about UI, but it has
> to on more than one occasion.  So if you want to lift Eglot's diagnostic-fixing
> things out of there

That's not strictly my goal, although it could be a nice side effect.
What's important is to have a good, backend-agnostic, experience for
fixing diagnostics.  Such a standard UI may subsume some of Eglot's
bespoke UI, but it may also be complementary and the two can coexist,
perhaps with some LSP-specific use cases only provided by Eglot.

> , I suggest lifting them into another library that is *not* Flymake.
> That library would tend to be the new refactor.el, which would always
> need an "edit" concept of its own (with more or less similarities to
> LSP).

I don't think of fixing diagnostics as a form of refactoring, rather as
a separate activity/use case, even though there's some technical overlap
in that both involve applying edits to code.  You fix diagnosed issues
in response to their detection, while a refactor operation (rename,
extract, ...) is something you mostly do unprompted.  Therefore
refactor.el is not the best place to put something like my proposed
flymake-fix, IMO.  We could have a separate library, say flyfix.el, and
put the fix-diagnostics UI there.  We'd still need Flymake backends to
communicate with this new library, since these backends are best
positioned for providing fixes for the issues they diagnose, but this
communication can be transparent to Flymake--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?

> I gave your refactor.el a *very* cursory read but it seems to be at
> least more or less the length and complexity I envisioned such a
> library having.  It has its own concept of edit, seems to know how to
> present things as diffs, all good things.  The tricky part if I
> remember was how to talk to the backend about the kinds of actions
> available.

That's definitely a challenge.  Currently I tried to keep things pretty
flexible: there are standard operations (so far only "rename", but I'm
planning to add "extract", "inline", and "organize" for imports) and
custom operations.  Backends can say which operations they can
facilitate, and that can include both standard and custom operations.
For standard operations, the library (refactor.el) takes care of all the
UI consideration and the backend only needs to provide data in a
standard format, while for custom actions the library gives control back
to the backend.


Eshel



  reply	other threads:[~2024-05-27 12:15 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 [this message]
2024-05-27 14:02         ` João Távora
2024-05-27 17:40           ` Eshel Yaron
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m17cffxxgg.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.