@@ -2,6 +2,7 @@ package decoder
2
2
3
3
import (
4
4
"context"
5
+ "log"
5
6
"sort"
6
7
7
8
"github.com/zclconf/go-cty/cty"
@@ -53,12 +54,14 @@ func (d *PathDecoder) tokensForBody(ctx context.Context, body *hclsyntax.Body, b
53
54
if _ , ok := body .Attributes ["count" ]; ok {
54
55
// append to context we need count provided
55
56
ctx = icontext .WithActiveCount (ctx )
57
+ log .Printf ("Found Expression: " )
56
58
}
57
59
}
58
60
}
59
61
60
62
for name , attr := range body .Attributes {
61
63
64
+ log .Printf ("Found: %q / %v+" , name , bodySchema .Extensions )
62
65
attrSchema , ok := bodySchema .Attributes [name ]
63
66
if ! ok {
64
67
if bodySchema .Extensions != nil && name == "count" && bodySchema .Extensions .Count {
@@ -90,6 +93,8 @@ func (d *PathDecoder) tokensForBody(ctx context.Context, body *hclsyntax.Body, b
90
93
})
91
94
92
95
ec := ExprConstraints (attrSchema .Expr )
96
+ countAvailable := icontext .ActiveCountFromContext (ctx )
97
+ log .Printf ("Found Expression: countAvailable %q " , countAvailable )
93
98
tokens = append (tokens , d .tokensForExpression (ctx , attr .Expr , ec )... )
94
99
}
95
100
@@ -170,7 +175,10 @@ func (d *PathDecoder) tokensForExpression(ctx context.Context, expr hclsyntax.Ex
170
175
},
171
176
}
172
177
countAvailable := icontext .ActiveCountFromContext (ctx )
173
- if address .Equals (countIndexAttr ) && countAvailable {
178
+ // TODO why is countAvailable not true here?
179
+ log .Printf ("Found Expression: %q / %q - %v+" , countAvailable , address .Equals (countIndexAttr ), address )
180
+ // if address.Equals(countIndexAttr) && countAvailable {
181
+ if address .Equals (countIndexAttr ) {
174
182
traversal := eType .AsTraversal ()
175
183
tokens = append (tokens , lang.SemanticToken {
176
184
Type : lang .TokenTraversalStep ,
0 commit comments