Skip to content

Write new formatting engine #1480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
rjmholt opened this issue May 6, 2020 · 1 comment
Open

Write new formatting engine #1480

rjmholt opened this issue May 6, 2020 · 1 comment
Milestone

Comments

@rjmholt
Copy link
Contributor

rjmholt commented May 6, 2020

PSSA2 currently only has an analyzer. It should also have a formatter.

In particular, the API should allow objects to implement an abstract class that doesn't emit diagnostics, but instead contributes edits to a formatting buffer.

Rules should be able to provide an implementation for this also by implementing an API that provides an instance of the required abstract class.

Requirements are:

  • Run as many formatters over the script as it can at once
  • When formatters want to overwrite the same extent, the largest wins
  • Attempt to run until no more formatters have edits to make, up to some maximum number of runs
  • Formatters should reuse the rule configuration system
@rjmholt rjmholt added this to the 2.0 milestone May 6, 2020
@ghost ghost added the Needs: Triage 🔍 label May 6, 2020
@bergmeister
Copy link
Collaborator

What if one formatter makes one change? You will have to translate the offset then (this is expected and should happen anyway, just hasn't been implemented atm). Currently re-parsing and reanalysis happens and even with implementing translation that would still be required when an overlapping extent is modified. I don't see it as a problem that the formatter re-uses the concept of a DiagnosticRecord.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants