Skip to content

Commit

Permalink
Implement for_each and each.* completion, hover info, and semantic to…
Browse files Browse the repository at this point in the history
…kens
  • Loading branch information
jpogran committed Oct 25, 2022
1 parent e12fb90 commit ef1e7ad
Show file tree
Hide file tree
Showing 8 changed files with 592 additions and 3 deletions.
9 changes: 9 additions & 0 deletions decoder/body_candidates.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ func (d *PathDecoder) bodySchemaCandidates(body *hclsyntax.Body, schema *schema.
candidates.List = append(candidates.List, attributeSchemaToCandidate("count", countAttributeSchema(), editRng))
}
}

if schema.Extensions.ForEach {
// A given resource or module block cannot use both count and for_each
// in the same block
if _, ok := body.Attributes["count"]; !ok {
candidates.List = append(candidates.List, attributeSchemaToCandidate("for_each", forEachAttributeSchema(), editRng))
// candidates.List = append(candidates.List, forEachAttributeCandidate(editRng))
}
}
}

if len(schema.Attributes) > 0 {
Expand Down
Loading

0 comments on commit ef1e7ad

Please sign in to comment.