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 71cdb42
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-20210607111743-09c4e3d54cdd
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-20210607111743-09c4e3d54cdd h1:CfHURxxCn2t1sIHsboGydHsaRAHp36MSL4jWEXLHOGU=
github.com/aztfmod/hcl-lang v0.0.0-20210607111743-09c4e3d54cdd/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 71cdb42

Please sign in to comment.