cue/format: improve indentation of in comprehensions

multi-line expressions used in comprehensions now
have an additional level of indentation.

Change-Id: Iabfc723d72c7cd989a07586160df7768930211a7
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/3962
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/format/node.go b/cue/format/node.go
index c0a3d4c..2c19f74 100644
--- a/cue/format/node.go
+++ b/cue/format/node.go
@@ -608,6 +608,7 @@
 	switch n := clause.(type) {
 	case *ast.ForClause:
 		f.print(n.For, "for", blank)
+		f.print(indent)
 		if n.Key != nil {
 			f.label(n.Key, false)
 			f.print(n.Colon, token.COMMA, blank)
@@ -618,10 +619,13 @@
 		f.label(n.Value, false)
 		f.print(blank, n.In, "in", blank)
 		f.expr(n.Source)
+		f.markUnindentLine()
 
 	case *ast.IfClause:
 		f.print(n.If, "if", blank)
+		f.print(indent)
 		f.expr(n.Condition)
+		f.markUnindentLine()
 
 	default:
 		panic("unknown clause type")
diff --git a/cue/format/testdata/expressions.golden b/cue/format/testdata/expressions.golden
index 9aa3e5d..0803ec4 100644
--- a/cue/format/testdata/expressions.golden
+++ b/cue/format/testdata/expressions.golden
@@ -171,6 +171,11 @@
 			"\(k)": v
 		}}
 
+	if a |
+		b {
+		c: d
+	}
+
 	e: [{
 		a: 1, b: 2
 	}]
diff --git a/cue/format/testdata/expressions.input b/cue/format/testdata/expressions.input
index 0908cc0..d9be66e 100644
--- a/cue/format/testdata/expressions.input
+++ b/cue/format/testdata/expressions.input
@@ -167,6 +167,11 @@
     if k > "a" {
         "\(k)":v}}
 
+    if a |
+    b {
+        c: d
+    }
+    
     e: [{
         a: 1, b: 2,
     }]