resyntax
resyntax copied to clipboard
[Feature request] Interactive fix mode
It would be nice to have an interactive fix mode, that would allow for applying rules selectively, and avoid cognitive overload by letting the user focus on changes one by one, instead of all at the time.
This mode would display potential fixes just like what analyze
does, but then for each fix it would ask, for example,
- fix
- skip
- see in context (opens your editor)
For example, I ported a Scheme project to Racket, and resyntax finds lots of potential refactorings (which is pretty neat!). But I'm not sure I want to apply all of them, and I'd like to check them one by one.
Are you thinking an interactive fix mode at the command line? Or already in the editor? My general sense is that when I'm doing interactive fixing, I'd probably want to do that by just looking at the code in an editor that highlights any issues detected by Resyntax and clicking a little "fix this one please" button.
In the editor would be ideal, but I think it's also valuable (and probably simpler) on the command line. I see it at first as
- Analyse the file
- Find the next possible fix and pause there.
- Propose to fix.
- If fix is accepted, apply it, save the file, got to 1, but skip all previously proposed fixes that have been rejected.
- Otherwise go to 2. until no more fix.
The re-analysis is not ideal, but at least it's robust and simple to implement. We can think of incremental re-analysis later as an improvement.
Would also be handy to have an option to fix the next possible fix and all fixes of the same type, since usually if you want to fix one occurrence of a particular type of problem you probably want to fix all of them.
apply / skip / apply-all <rule-name>… / apply none <rule-name> / abort
?