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

formatter.Format is not applicable to ast.Node #670

Open
m-messiah opened this issue Feb 22, 2023 · 0 comments
Open

formatter.Format is not applicable to ast.Node #670

m-messiah opened this issue Feb 22, 2023 · 0 comments

Comments

@m-messiah
Copy link

m-messiah commented Feb 22, 2023

jsonnetfmt.Format makes a lot of good logic in the internal method without exposing as methods.

This results in disability to use custom-written formatters and get the best from jsonnetfmt, requiring to pipe results to jsonnetfmt after any changes, which is more frustrating when we already have ast.Node and do not need to unparse it again.

Let's expose everything Format does as a new method FormatNode(root ast.Node, finalFodder ast.Fodder, options formatter.Options) and keep initial Format() as a wrapper that does AST and applies FormatNode to it?

@m-messiah m-messiah changed the title formatter.Unparser keeps initial newline formatter.Format is not applicable to ast.Node Feb 22, 2023
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

1 participant