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 comments when pretty printing concrete syntax #1737
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
janmasrovira
force-pushed
the
print-comments
branch
from
January 23, 2023 10:23
4827ddd
to
4b242a2
Compare
janmasrovira
force-pushed
the
print-comments
branch
from
January 23, 2023 10:49
b1f7eda
to
3637635
Compare
jonaprieto
reviewed
Jan 23, 2023
jonaprieto
reviewed
Jan 23, 2023
janmasrovira
force-pushed
the
print-comments
branch
from
January 23, 2023 16:18
3a6e619
to
3c38fea
Compare
janmasrovira
force-pushed
the
print-comments
branch
from
January 24, 2023 07:20
3c38fea
to
a2889ec
Compare
jonaprieto
approved these changes
Jan 24, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pr adds a new pretty printing algorithm for scoped concrete syntax.
This new algorithm works as the old one but will also print the normal comments in the appropriate places.
This is a work in pogress. What remains to be done is printing comments that are in the middle of an expression. Currently these comments will be printed but just before the expression. Also, it should support parsed (pre-scoping) concrete syntax.
To run the new algorithm the flag
--with-comments
must be passed to thedev scope
command.When we finish the pending tasks, we may want to make this the default algorithm and have a
--with-no-comments
flag instead.I have updated the
juvix-format-buffer
to use the--with-comments
flag. Now it should be safe (sans the expression quirk mentioned above) to run the formatter within emacs.I have adapted the scoping tests to also be executed with the new algorithm. These tests make sure that the pretty printed code is sound but do not check that the printed comments are in the appropriate places. For that, I have done some manual testing. In a future pr we should find a way to test it automatically.