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

Create an auto-formatter #48

Open
Aloso opened this issue Aug 2, 2022 · 0 comments
Open

Create an auto-formatter #48

Aloso opened this issue Aug 2, 2022 · 0 comments
Labels
C-tooling Tools such as IDE integrations, formatters, linters, etc. enhancement New feature or request

Comments

@Aloso
Copy link
Member

Aloso commented Aug 2, 2022

Is your feature request related to a problem? Please describe.

There is currently no way to automatically format a pomsky expression.

Describe the solution you'd like

A tool, part of pomsky-bin, that accepts several configuration options similar to prettier, parses a pomsky expression losslessly (preserving comments and whitespace), and returns a pomsky expression that is beautifully formatted, without changing its semantic meaning. Here are some things it can do:

  • Add/remove white space
  • Add/remove a leading pipe
  • Remove unnecessary parentheses
  • Convert double quotes to single quotes or vice versa
  • Simplify repetitons (e.g. {1,} -> +)
  • Wrap comments
  • Replace deprecated syntax

Things it can not (or should not) do:

  • Do anything that changes what the expression can match
  • Rename identifiers
  • Remove or reorder comments
  • Reorder alternatives or character set contents
  • Remove unreachable expressions
@Aloso Aloso added enhancement New feature or request C-tooling Tools such as IDE integrations, formatters, linters, etc. labels Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tooling Tools such as IDE integrations, formatters, linters, etc. enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant