You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Therefore we end up picking just exact type matches data.aws_availability_zones.available.id and data.aws_availability_zones.available.state as both are of string type.
However, we have no way of knowing whether this is a final completion or just beginning and there are other relevant reference targets we could still offer. Sets are not directly addressable and there's no point of making them until #530 or #527 We can however try "descending" into lists, i.e. additionally suggest the following:
Discovered originally in hashicorp/vscode-terraform#990 (comment)
Background
The language server currently only provides completion of references to targets which are "directly addressable" and have a matching type.
e.g.
availability_zone
field is of typestring
and available references targets underdata.aws_availability_zones.available
are the following:data.aws_availability_zones.available.all_availability_zones
(ScopeId: "data", Type: "cty.Bool")data.aws_availability_zones.available.exclude_names
(ScopeId: "data", Type: "cty.Set(cty.String)")data.aws_availability_zones.available.exclude_zone_ids
(ScopeId: "data", Type: "cty.Set(cty.String)")data.aws_availability_zones.available.group_names
(ScopeId: "data", Type: "cty.Set(cty.String)")data.aws_availability_zones.available.id
(ScopeId: "data", Type: "cty.String")data.aws_availability_zones.available.names
(ScopeId: "data", Type: "cty.List(cty.String)")data.aws_availability_zones.available.state
(ScopeId: "data", Type: "cty.String")data.aws_availability_zones.available.zone_ids
(ScopeId: "data", Type: "cty.List(cty.String)")Therefore we end up picking just exact type matches
data.aws_availability_zones.available.id
anddata.aws_availability_zones.available.state
as both are ofstring
type.However, we have no way of knowing whether this is a final completion or just beginning and there are other relevant reference targets we could still offer. Sets are not directly addressable and there's no point of making them until #530 or #527 We can however try "descending" into lists, i.e. additionally suggest the following:
data.aws_availability_zones.available.names
(ScopeId: "data", Type: "cty.List(cty.String)")data.aws_availability_zones.available.zone_ids
(ScopeId: "data", Type: "cty.List(cty.String)")Proposal
Update type matching within
hcl-lang
to descend into lists and possibly maps and tuples, all of which are directly addressable via[]
syntax.https://github.com/hashicorp/hcl-lang/blob/d770b425fb2288fdcbf223b6955485a989dd3221/reference/targets.go#L78-L79
The text was updated successfully, but these errors were encountered: