Skip to content

Commit 998e3b9

Browse files
committed
wip
1 parent 1f03be9 commit 998e3b9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

decoder/semantic_tokens.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package decoder
22

33
import (
44
"context"
5+
"log"
56
"sort"
67

78
"github.com/zclconf/go-cty/cty"
@@ -53,12 +54,14 @@ func (d *PathDecoder) tokensForBody(ctx context.Context, body *hclsyntax.Body, b
5354
if _, ok := body.Attributes["count"]; ok {
5455
// append to context we need count provided
5556
ctx = icontext.WithActiveCount(ctx)
57+
log.Printf("Found Expression: ")
5658
}
5759
}
5860
}
5961

6062
for name, attr := range body.Attributes {
6163

64+
log.Printf("Found: %q / %v+", name, bodySchema.Extensions)
6265
attrSchema, ok := bodySchema.Attributes[name]
6366
if !ok {
6467
if bodySchema.Extensions != nil && name == "count" && bodySchema.Extensions.Count {
@@ -90,6 +93,8 @@ func (d *PathDecoder) tokensForBody(ctx context.Context, body *hclsyntax.Body, b
9093
})
9194

9295
ec := ExprConstraints(attrSchema.Expr)
96+
countAvailable := icontext.ActiveCountFromContext(ctx)
97+
log.Printf("Found Expression: countAvailable %q ", countAvailable)
9398
tokens = append(tokens, d.tokensForExpression(ctx, attr.Expr, ec)...)
9499
}
95100

@@ -170,7 +175,10 @@ func (d *PathDecoder) tokensForExpression(ctx context.Context, expr hclsyntax.Ex
170175
},
171176
}
172177
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) {
174182
traversal := eType.AsTraversal()
175183
tokens = append(tokens, lang.SemanticToken{
176184
Type: lang.TokenTraversalStep,

0 commit comments

Comments
 (0)