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

Add Ast node(s) representing comments #3372

Open
hamnis opened this issue Oct 23, 2023 · 1 comment
Open

Add Ast node(s) representing comments #3372

hamnis opened this issue Oct 23, 2023 · 1 comment

Comments

@hamnis
Copy link

hamnis commented Oct 23, 2023

Sometimes it is very useful to be able to add comments to generated code when using scalameta.
Currently this is not possible.

val instances: List[Stat] = cases.map(c => q"""
           // ${c.comment}
           case object ${c.name.termName} extends $init""")

/*
can't unquote into single-line comments
          ${c.comment}
*/

This is the same with multi-line comments.

@tgodzik
Copy link
Collaborator

tgodzik commented Oct 24, 2023

Thanks for raising this! As mentioned on discord there was a previous discussion at #1137 (comment)

It seems that having comments in quasiquotes is most problematic, we could do attachements or special AST nodes that woul pretty print correctly.

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

2 participants