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

Way to disable formatting #35

Open
Elsie19 opened this issue Jun 7, 2024 · 3 comments
Open

Way to disable formatting #35

Elsie19 opened this issue Jun 7, 2024 · 3 comments

Comments

@Elsie19
Copy link

Elsie19 commented Jun 7, 2024

Currently, I am trying to stylize a definition to make it clearer at a first glance:

ifStatement = {
    "if" ~ space+ ~ ifStatementMatch ~ newline+ ~ (space+)? ~ "then"
        ~ (space+ | newline+) ~ (#then_block = statement)+
        ~ (newline+ ~ "else" ~ newline+
        ~ (#else_block = statement)+)? ~ newline+ ~ (space+)? ~ "fi" }

But when I save the file, it turns into this:

ifStatement = {
    "if" ~ space+ ~ ifStatementMatch ~ newline+ ~ (space+)? ~ "then" ~ (space+ | newline+) ~ (#then_block = statement)+ ~ (newline+ ~ "else" ~ newline+ ~ (#else_block = statement)+)? ~ newline+ ~ (space+)? ~ "fi"
}

Which just compresses everything into one line. Is there a way or possibility of selectively disabling formatting for an arbitrary definition?

@Jamalam360 Jamalam360 transferred this issue from pest-parser/pest-ide-tools Jun 8, 2024
@Jamalam360
Copy link

I've transferred this to pest-fmt since IDE tools just calls that.

I presume you want a comment syntax like // pest-fmt-disable which disables formatting for the next rule definition?

@Elsie19
Copy link
Author

Elsie19 commented Jun 8, 2024

Yes, that would be preferable.

@diversable
Copy link

Seconded!

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

No branches or pull requests

3 participants