Skip to content

Commit

Permalink
Support for-in-if expressions (#368)
Browse files Browse the repository at this point in the history
* decoder: Provide completion for ForExpr

* decoder: Provide hover for ForExpr

* decoder: Provide semantic tokens for ForExpr

* decoder: Provide reference origins for ForExpr
  • Loading branch information
radeksimko authored Feb 6, 2024
1 parent 2d4b88d commit 6a6bede
Show file tree
Hide file tree
Showing 9 changed files with 2,414 additions and 4 deletions.
7 changes: 6 additions & 1 deletion decoder/expr_any_completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ func (a Any) completeNonComplexExprAtPos(ctx context.Context, pos hcl.Pos) []lan
candidates := make([]lang.Candidate, 0)

// TODO: Support splat expression https://github.com/hashicorp/terraform-ls/issues/526
// TODO: Support for-in-if expression https://github.com/hashicorp/terraform-ls/issues/527
// TODO: Support relative traversals https://github.com/hashicorp/terraform-ls/issues/532

opCandidates, ok := a.completeOperatorExprAtPos(ctx, pos)
Expand All @@ -121,6 +120,12 @@ func (a Any) completeNonComplexExprAtPos(ctx context.Context, pos hcl.Pos) []lan
}
candidates = append(candidates, condCandidates...)

forCandidates, ok := a.completeForExprAtPos(ctx, pos)
if !ok {
return candidates
}
candidates = append(candidates, forCandidates...)

ref := Reference{
expr: a.expr,
cons: schema.Reference{OfType: a.cons.OfType},
Expand Down
Loading

0 comments on commit 6a6bede

Please sign in to comment.