github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/cue/format/testdata/comments.golden (about)

     1  // Package line 1 group 1
     2  // Package line 2 group 1
     3  
     4  // Package line 1 - group 2
     5  // Package line 2 - group 2
     6  package comments
     7  
     8  // Emit line 1 group 1
     9  
    10  // Emit line 1 group 2
    11  // Emit line 2 group 2
    12  {
    13  	// Inside Emit
    14  }
    15  
    16  a: 3 // a line comment
    17  
    18  b:  4   // line comment that is last in the file.
    19  cc: 555 // align comments
    20  
    21  // don't simplify
    22  a: {
    23  	b: 2
    24  }
    25  
    26  // simplify
    27  a: {
    28  	b: c: d: 1
    29  }
    30  
    31  // unchanged
    32  a: b: [1]
    33  
    34  // don't simplify
    35  a: b: c: 2
    36  
    37  // rewrite okay
    38  a: b: c: d: 2
    39  
    40  m: {
    41  }
    42  m: {
    43  	// empty with comment
    44  }
    45  
    46  // Issue #478
    47  struct1: {
    48  	// This is a comment
    49  
    50  	// This is a comment
    51  
    52  	// Another comment
    53  
    54  	something: {
    55  	}
    56  	// extra comment
    57  }
    58  
    59  struct2: {
    60  	// This is a comment
    61  
    62  	// This is a comment
    63  
    64  	// Another comment
    65  	something: {
    66  	}
    67  
    68  	// extra comment
    69  }
    70  
    71  list1: [
    72  	// Comment1
    73  
    74  	// Comment2
    75  
    76  	// Another comment
    77  	{
    78  	}
    79  
    80  	// Comment 3,
    81  ]
    82  
    83  list2: [
    84  	// foo
    85  ]
    86  
    87  list3: [
    88  	// foo
    89  
    90  	// bar
    91  ]
    92  
    93  funcArg1: foo(
    94  		// Comment1
    95  
    96  	// Comment2
    97  	3,
    98  
    99  	// Comment3
   100  	)
   101  
   102  funcArg2: foo(
   103  		// Comment1
   104  
   105  	// Comment2
   106  
   107  	3,
   108  	// Comment3
   109  	)
   110  
   111  funcArg3: foo(
   112  		2,
   113  
   114  	// Comment1
   115  
   116  	// Comment2
   117  	3,
   118  
   119  	// Comment3
   120  	)