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
Most of these are to do with comment formatting, but there's a deeper issue here: what should happen to comments when we apply unification to CUE values?
Here's a simple example to illustrate current behaviour:
Running cue def on that results in the following output:
// Comment 1
// Comment 2
// Comment 3
a: 1
Running cue def again gives:
// Comment 3
a: 1
This isn't great for a few reasons:
cue def should probably produce output that doesn't change when run through cue def again.
The result is dependent on the order of unification. If the three parts are in three separate files, the order of the comments depends on the file names.
comments are lost the second time cue def is run
There's no obvious "right answer" here. Some possibilities:
Don't output comments at all.
Keep a single comment only; any additional comments cause the comment to disappear
Retain all comments, concatenating comment text from all unifications, sorting by comment text.
Provide a way to customize whether a comment is included or not.
Choice 1 is obviously the easiest option, but comments are very useful and if possible it would be good to better than that.
Choice 2 makes for unstable output. If someone adds a comment to a schema, it could cause an important comment on the data to disappear.
Choice 3 results in comments that are a mishmash from different layers in non-obvious order. It's not clear that we actually want all comments anyway. Consider this example. That workflow schema has copious comments that describe how to use the schema, but those aren't very useful on the final result, where we'd prefer to see comments about the final rendered workflow rather than the schema.
Choice 4 could potentially provide the best of both worlds, but leaves open the question of how that customization might work.
The text was updated successfully, but these errors were encountered:
There are a number of open issues regarding comments:
cue fix
tries to align comments inside braces with those outside, causing weird field indentation #1006Most of these are to do with comment formatting, but there's a deeper issue here: what should happen to comments when we apply unification to CUE values?
Here's a simple example to illustrate current behaviour:
Running
cue def
on that results in the following output:Running
cue def
again gives:This isn't great for a few reasons:
cue def
should probably produce output that doesn't change when run throughcue def
again.cue def
is runThere's no obvious "right answer" here. Some possibilities:
Choice 1 is obviously the easiest option, but comments are very useful and if possible it would be good to better than that.
Choice 2 makes for unstable output. If someone adds a comment to a schema, it could cause an important comment on the data to disappear.
Choice 3 results in comments that are a mishmash from different layers in non-obvious order. It's not clear that we actually want all comments anyway. Consider this example. That workflow schema has copious comments that describe how to use the schema, but those aren't very useful on the final result, where we'd prefer to see comments about the final rendered workflow rather than the schema.
Choice 4 could potentially provide the best of both worlds, but leaves open the question of how that customization might work.
The text was updated successfully, but these errors were encountered: