-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
syntax: fix whitespace on nested subshells #869
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
we want white space on nested subshells if its in a single line since its ambiguous, eg we want `( (` over `((` this shouldn't be the case for multiple lines- fix the logic that adds white space to only do so if the two subshells are in the same line fixes mvdan#814
mvdan
reviewed
May 31, 2022
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.
Some thoughts :)
the fix fall short for some scenarios such as when we actually want new line, eg there's more than one statement; fix the logic to also not add white space for such scenarios also add more tests for the different types
riacataquian
force-pushed
the
fix-814-syntax
branch
from
June 1, 2022 16:37
9b52502
to
52458f0
Compare
mvdan
approved these changes
Jun 2, 2022
riacataquian
force-pushed
the
fix-814-syntax
branch
from
June 2, 2022 16:06
adc73fb
to
7a1540e
Compare
on instances when command is a SubShell, `startsWithLparen` condition is met and there's more than one statement, we want: - space between the statements if `SingleLine` is enabled - new line between the statements if `Minify` is enabled otherwise we'd get `reached ) without matching (( with ))` syntax errors; rightfully so, because of the root issue we've been trying to solve, being `((` is ambiguous
mvdan
approved these changes
Jun 6, 2022
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.
Tests LGTM, thanks! Just some code nits.
- make the if conditions more readable by adding parentheses separators - reword comment on the double parens ambiguity - make use of the `mustNewLine` variable to tell `stmtList` we must write a new line, instead of explicitly writing it up front
riacataquian
force-pushed
the
fix-814-syntax
branch
from
June 6, 2022 13:01
2dc2d72
to
23457f2
Compare
mvdan
approved these changes
Jun 6, 2022
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.
we want white space on nested subshells if its in a single line since
its ambiguous, eg we want
( (
over((
this shouldn't be the case for multiple lines- fix the logic that adds
white space to only do so if the two subshells are in the same line
fixes #814