-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cue/format: avoid indenting a lone leading comment
We would often precede a comment with a vertical tab for alignment, even when a comment began at the start of the line, where vertical alignment is completely pointless. This was largely harmless, except in a few edge cases such as a single comment followed by a declaration, where we would indent. Instead, only add the vertical tab if the comment does not begin at the start of the line, resolving these issues. Note that this change requires no longer using internal.NewComment for top-level comments in a file, as the API always sets either of the Doc or Line booleans in ast.Comment, causing extra and unwanted blank spaces or newlines. A lone comment at the start of a file is neither a doc comment nor a line (inline) comment. Fixes #722. Signed-off-by: Daniel Martí <[email protected]> Change-Id: If9f1afb3f3e6dbdf65d5ee28c76a0f279c97aa49 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1196134 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Aram Hăvărneanu <[email protected]>
- Loading branch information
Showing
9 changed files
with
14 additions
and
13 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,7 +137,7 @@ diff old new | |
+++ new | ||
@@ -1,10 +1,7 @@ | ||
import "tool/exec" | ||
|
||
// Can be inlined. | ||
-v: { | ||
- x: 3 | ||
|
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