Figure out what code-modifying tools should do about formatting
- Dominant language
- Go
- Stars
- 1.8k
- Forks
- 263
- PR merge metrics
- No merged PRs in 30d
Description
Currently there are no code-modifying tools, other than the autoformatter that I know about, but we may want to add autofix to linter one day. Some 3rd party users also expressed interest in writing code-manipulating tools.
This is finally possible with the addition of Fodder to the AST. Unfortunately it is still not clear how to actually save the AST back in the text form. Using autoformatter to dump AST requires being aware of the formatting options. Also, using a pinned version of the formatter makes sense.
Perhaps we can have a near-full-fidelity, optionless unparser?
The tools could then change the affected part of the code, without affecting the rest too much. Implementing such unparser may require changing the definition of the Fodder and saving some additional info in the AST.
Contributor guide
Assessment
This issue has not been assessed yet.