You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ cue version
cue version v0.6.0
go version go1.20.7
-buildmode exe
-compiler gc
-trimpath true
CGO_ENABLED 1
GOARCH arm64
GOOS darwin
Does this issue reproduce with the latest stable release?
Yes.
What did you do?
Wrote a tool file and ran cue fmt -s on it. While the output of the formatting is correct, it changes the behavior of the tool file by changing the scope of the comment attached to the command.
$ cat make_tool.cue
package make_tool
import (
"tool/exec"
)
// displays help for available commands
command: help: {
show: exec.Run & {cmd: [ "sh", "-c", "cue help cmd | grep -A2 'Available Commands:'"]}
}
$ cue cmd help
Available Commands:
help displays help for available commands
$ cue fmt -s make_tool.cue
# note that the help text is gone
$ cue cmd help
Available Commands:
help
# that's because the comment is now scoped to command: help: show instead of command: help
$ cat make_tool.cue
package make_tool
import (
"tool/exec"
)
// displays help for available commands
command: help: show: exec.Run & {cmd: [ "sh", "-c", "cue help cmd | grep -A2 'Available Commands:'"]}
What did you expect to see?
No change to the behavior of the cue cmd help output after simplification
What did you see instead?
The help text disappears because of the scope change of the comment
The text was updated successfully, but these errors were encountered:
gotwarlost
changed the title
cue fmt -s simplifies too much for tool files
cue fmt -s does not preserve the scope of comments which is important for tool files
Nov 2, 2023
gotwarlost
changed the title
cue fmt -s does not preserve the scope of comments which is important for tool files
cmd/cue: fmt -s does not preserve the scope of comments which is important for tool files
Nov 21, 2023
What version of CUE are you using (
cue version
)?Does this issue reproduce with the latest stable release?
Yes.
What did you do?
Wrote a tool file and ran
cue fmt -s
on it. While the output of the formatting is correct, it changes the behavior of the tool file by changing the scope of the comment attached to the command.What did you expect to see?
No change to the behavior of the
cue cmd help
output after simplificationWhat did you see instead?
The help text disappears because of the scope change of the comment
The text was updated successfully, but these errors were encountered: