Skip to content
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

Button for running a code formatter #9

Open
tomsmeding opened this issue Feb 1, 2023 · 1 comment
Open

Button for running a code formatter #9

tomsmeding opened this issue Feb 1, 2023 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@tomsmeding
Copy link
Collaborator

tomsmeding commented Feb 1, 2023

To make the playground double as a place for trying out different Haskell code formatters without having to download and build them all, it would be nice to have a UI element to run your code through one of a couple of high-profile code formatters (ormolu, brittany, stylish-haskell, maybe even configurable fourmolu?, others?). How exactly this UI element should look, I'm not sure. It definitely shouldn't take up a lot of space if you're not using it.

Some things to think about:

  • If the formatter runs on the server (probably), doing a formatting operation should also count (a little bit) against your spam score. How much should depend on how long a formatter takes to process some file; hopefully this is not very long usually?
  • We should verify for each formatter in question that they not have any risk of actually running part of the code being formatted (I'm thinking about too-clever handling of CPP or TH), because then that would be unsafe.
  • It should hook into the undo/redo functionality of the Ace editor so that the user can undo the formatting easily.
@tomsmeding tomsmeding added enhancement New feature or request help wanted Extra attention is needed labels Feb 1, 2023
@Kleidukos
Copy link
Member

How much should depend on how long a formatter takes to process some file; hopefully this is not very long usually?

It's usually fairly quick yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants