Open eric-wieser opened 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?
Proposal
It should be possible for linters to use
Meta.Tactic.TryThis.addSuggestion
and friends to add "Try this:" suggestionsOften, 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:
runLinters
should preserveinfoState
(andtraceState
for good measure?)ContextInfo.runMetaM
should do the same (as linters may need this to run elaborators from the info tree)Lean.Elab.InfoTree.visitM
; or linters need to be very conservative about accidentally creating other infotree nodes.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.