-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Fix comments with brackets #456
Conversation
There's actually an easy way to fix this, but I don't know if there are other consequences. Just remove this taplo/crates/taplo/src/formatter/mod.rs Lines 1109 to 1112 in 5bd9625
This |
That condition seems to be never hit in any of the tests. The intention seems to be that if an array contains an array with a trailing comment like this: array_of_arrays = [
[1, 2] # comment
] … that array is supposed to be kept in the same line. But seems like that happens in any case? Anyway, this is a high priority fix since it actually protects data from being silently deleted, so I think not much time should be wasted to merge it speculating about possible follow up issues. If there is one, it can just be fixed later while taking care to not break the regression test I added here, no? Other thought: then this line is also wrong, but at least it doesn’t destroy data. it just messes up formatting in the (more rare) case of a comment ending with taplo/crates/taplo/src/formatter/mod.rs Line 1031 in f2685c0
|
This comment was marked as off-topic.
This comment was marked as off-topic.
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.
I tried to play around to find when the if
does not trigger but couldn't. So I agree we can move forward and wait until someone comes up with an example. In the absence of a test breaking, I think we can say that this is not an important feature that is being removed.
I don't think the [
case is similar, because it can't come after a comment. The only thing that can follow a comment is a newline by definition of a comment. So only the occurrence in the NEWLINE case is actually problematic.
could we get a release with this? |
Ideally, I'd like #434 to get fixed before releasing. It's an important blocker for releasing to VS Code. Feel free to take a look at it if you're familiar with VS Code. PRs are welcome. Thanks! |
I fixed that one, see #462 |
Fixes #455