Skip to content

Commit

Permalink
Add support for variable type
Browse files Browse the repository at this point in the history
So that completion, hover and semantic-tokens work for variable `type`.

Related to hashicorp/terraform-ls#490
  • Loading branch information
beandrad committed Jun 7, 2021
1 parent 2fb6ae2 commit 2eb5417
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ require (
github.com/zclconf/go-cty v1.8.3
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b
)

replace github.com/hashicorp/hcl-lang v0.0.0-20210603100913-81056fd9a6e0 => github.com/aztfmod/hcl-lang v0.0.0-20210607121106-47260b279327
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2
github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk=
github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
github.com/aztfmod/hcl-lang v0.0.0-20210607121106-47260b279327 h1:6r8Ht2dkF21YpoPXezmRvH9kbbBLSzf9c5f/figHuLc=
github.com/aztfmod/hcl-lang v0.0.0-20210607121106-47260b279327/go.mod h1:uMsq6wV8ZXEH8qndov4tncXlHDYnZ8aHsGmS4T74e2o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -27,8 +29,6 @@ github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.3.0 h1:McDWVJIU/y+u1BRV06dPaLfLCaT7fUTJLp5r04x7iNw=
github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/hcl-lang v0.0.0-20210603100913-81056fd9a6e0 h1:CmEDMGKu8J5E8Yk4lcYwS8tC/K2ybAQ4nStw8raIjVQ=
github.com/hashicorp/hcl-lang v0.0.0-20210603100913-81056fd9a6e0/go.mod h1:uMsq6wV8ZXEH8qndov4tncXlHDYnZ8aHsGmS4T74e2o=
github.com/hashicorp/hcl/v2 v2.10.0 h1:1S1UnuhDGlv3gRFV4+0EdwB+znNP5HmcGbIqwnSCByg=
github.com/hashicorp/hcl/v2 v2.10.0/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg=
github.com/hashicorp/terraform-json v0.11.0 h1:4zDqqW2F3kOysORIaYKFGgWDYIRA3hwqx3XHeHkbBQ0=
Expand Down
2 changes: 1 addition & 1 deletion internal/schema/0.12/variable_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func variableBlockSchema(v *version.Version) *schema.BlockSchema {
Description: lang.Markdown("Description to document the purpose of the variable and what value is expected"),
},
"type": {
Expr: schema.ExprConstraints{},
Expr: schema.ExprConstraints{schema.TypeDeclarationExpr{}},
IsOptional: true,
Description: lang.Markdown("Type constraint restricting the type of value to accept, e.g. `string` or `list(string)`"),
},
Expand Down
2 changes: 1 addition & 1 deletion internal/schema/0.14/variable_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var variableBlockSchema = &schema.BlockSchema{
Description: lang.Markdown("Description to document the purpose of the variable and what value is expected"),
},
"type": {
Expr: schema.ExprConstraints{},
Expr: schema.ExprConstraints{schema.TypeDeclarationExpr{}},
IsOptional: true,
Description: lang.Markdown("Type constraint restricting the type of value to accept, e.g. `string` or `list(string)`"),
},
Expand Down

0 comments on commit 2eb5417

Please sign in to comment.