-
Notifications
You must be signed in to change notification settings - Fork 287
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
cue/format: let/comprehension incorrectly indented when first expression in file #1544
Comments
myitcv
changed the title
cue/format: let incorrectly indented when first expression in file
cue/format: let/comprehension incorrectly indented when first expression in file
Feb 22, 2022
FogDong
added a commit
to FogDong/cue
that referenced
this issue
May 6, 2022
This PR reset the allow for clauses at the position 0. Fixes cue-lang#1544 Signed-off-by: Fog Dong <wuwuglu19@gmail.com>
FogDong
added a commit
to FogDong/cue
that referenced
this issue
May 10, 2022
This PR reset the allow of blanks at the position 0. Fixes cue-lang#1544 Signed-off-by: Fog Dong <wuwuglu19@gmail.com>
FogDong
added a commit
to FogDong/cue
that referenced
this issue
May 10, 2022
This PR reset the allow for blanks at the position 0. Fixes cue-lang#1544 Signed-off-by: Fog Dong <wuwuglu19@gmail.com>
cueckoo
pushed a commit
that referenced
this issue
May 24, 2022
When printing clauses, we often want to print a whitespace before the token "let", "if", and "for". For example: for i, v in src if i > 1 { As opposed to omitting spaces, which breaks the syntax: for i, v in srcif i > 1 { However, we also printed a space before the first clause in the list. This could result in a CUE file beginning with a space if the first token is a clause: $ cue fmt . $ cat if.cue if foo { } First, we fix that bug for clauses by not having walkClauseList call f.print(blank) before the first clause. Second, we also fix it for "let" declarations by teaching mayCombine about the previous token being ILLEGAL - meaning that we're printing the first token in the entire file. It is worth noting that this also changes how we print the first clause inside another expression; for instance: cfgs: [ for crd in ["one", "two"] { }] Now formats without the leading space, just like at the beginning of a file: cfgs: [for crd in ["one", "two"] { }] Arguably that is more consistent, as there is no space after the "for" clause, following the "}" token. Fixes #1544. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: I72e4618f2b1011005316c617a32e0c3a6ff3b706
cueckoo
pushed a commit
that referenced
this issue
Jun 10, 2024
This allows us to test many small files without exploding the number of files tracked by VCS inside testdata. For example, to fix https://cuelang.org/issue/1544, we would want to cover various clauses at the start of a short file. For #1544. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: Ifd93b98c26028de9e03f33ea697af49047989b61
cueckoo
pushed a commit
that referenced
this issue
Jun 10, 2024
This shows the current buggy behavior, where comprehensions at the start of a file gain a blank space. For #1544. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: I9751f0eae5408c2c9e11b95e83107441e3209cc4
cueckoo
pushed a commit
that referenced
this issue
Jun 10, 2024
When printing clauses, we often want to print a whitespace before the token "let", "if", and "for". For example: for i, v in src if i > 1 { As opposed to omitting spaces, which breaks the syntax: for i, v in srcif i > 1 { However, we also printed a space before the first clause in the list. This could result in a CUE file beginning with a space if the first token is a clause: $ cue fmt . $ cat if.cue if foo { } First, we fix that bug for clauses by not having walkClauseList call f.print(blank) before the first clause. Second, we also fix it for "let" declarations by teaching mayCombine about the previous token being ILLEGAL - meaning that we're printing the first token in the entire file. It is worth noting that this also changes how we print the first clause inside another expression; for instance: cfgs: [ for crd in ["one", "two"] { }] Now formats without the leading space, just like at the beginning of a file: cfgs: [for crd in ["one", "two"] { }] Arguably that is more consistent, as there is no space after the "for" clause, following the "}" token. Fixes #1544. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: I72e4618f2b1011005316c617a32e0c3a6ff3b706
cueckoo
pushed a commit
that referenced
this issue
Jun 10, 2024
This allows us to test many small files without exploding the number of files tracked by VCS inside testdata. For example, to fix https://cuelang.org/issue/1544, we would want to cover various clauses at the start of a short file. For #1544. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: Ifd93b98c26028de9e03f33ea697af49047989b61 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1196106 Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com> Reviewed-by: Marcel van Lohuizen <mpvl@gmail.com> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
cueckoo
pushed a commit
that referenced
this issue
Jun 10, 2024
This shows the current buggy behavior, where comprehensions at the start of a file gain a blank space. For #1544. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: I9751f0eae5408c2c9e11b95e83107441e3209cc4 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1196107 Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com> Reviewed-by: Marcel van Lohuizen <mpvl@gmail.com> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of CUE are you using (
cue version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
What did you expect to see?
Passing test
What did you see instead?
But note that currently all comparisons fail because in each case the expression is indented by a single space.
The text was updated successfully, but these errors were encountered: