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

Print literal value instead of crashing on missing text annotation #232

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

richcarl
Copy link
Contributor

@richcarl richcarl commented Dec 7, 2020

This allows you to format syntax trees that have been synthesized outside erlfmt without forcing the caller to add "text" annotations for all literals in order to print them.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 7, 2020
@awalterschulze
Copy link
Member

Would it be possible to parse the AST and transform it to include these "text" annotations, before passing it back to erlfmt?

Or include a test with an explanation comment, so that we do not simplify this code later by accident?

@richcarl
Copy link
Contributor Author

richcarl commented Dec 7, 2020

It is of course possible, just a bit annoying and expensive to do an extra pass rewriting the whole AST for this.

@awalterschulze
Copy link
Member

If it is too much effort to have an extra pass over the AST, consider adding a test, with a comment that explains why this is necessary, to make sure we do not regress and remove this change when thinking we are cleaning things up.

@awalterschulze
Copy link
Member

This is probably go to merge, just need a test.
Do you want to add a test or maybe we can add one for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants