leanprover / lean4

Lean 4 programming language and theorem prover
https://lean-lang.org
Apache License 2.0
4.57k stars 405 forks source link

RFC: linters should be able to use try this #4363

Open eric-wieser opened 4 months ago

eric-wieser commented 4 months ago

Proposal

It should be possible for linters to use Meta.Tactic.TryThis.addSuggestion and friends to add "Try this:" suggestions

Often, a linter can not only identify the problem, but also suggest a fix. It would be very convenient in these cases to apply the fix with a single click, and not have to write a separate code action. Some examples include

Currently, when addSuggestion is used, the suggestion appears in the info view, but only as a log message and not as a widget.

An outline of how this might look:

Community Feedback

Zulip conversation

Impact

Add :+1: to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add :+1: to it.

kmill commented 4 months ago

Something that would improve this RFC is a concrete example or two of the impact of this on this from a user's point of view. What's a piece of user code that would trigger a linter, and what kind of 'try this' suggestion would it give?