-
Notifications
You must be signed in to change notification settings - Fork 89
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 tests for comments in more expression-like contexts #2000
Conversation
I wonder if we should omit the whitespace in between silent comment and sibling tokens during output if possible? |
It's not generally safe to omit that whitespace entirely—for example, |
================================================================================ | ||
<===> comment/progid/before_close_paren/silent/input.scss | ||
a { | ||
b: progid:c(d // |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are multiple lines with //
, are they considered a single silent comment, or multiple silent comments?
For example, would this block:
a {
b: progid:c(d // foo
// bar
);
}
result in this?:
a {
b: progid:c(d
);
}
And if so, is that OK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not considered a single comment, but the whitespace around them is still considered "adjacent" so you won't end up with multiple newlines.
If we treat silent comment as a kind of whitespace when processing AST, I think this can potentially allow us to fold it more aggressively based on context, even under the current logic. For example, if silent comment is treated as whitespace: Not sure if there is any corner case, and I haven't looked at the implementation details so not sure how much work it is. If it's too much work we can just leave it as is. |
See sass/dart-sass#2263
[skip dart-sass]