Skip to content

Create an auto-formatter #48

Open
Open
@Aloso

Description

@Aloso

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-toolingTools such as IDE integrations, formatters, linters, etc.enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions