Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schema: Add custom token modifiers #99

Merged
merged 1 commit into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.14
require (
github.com/google/go-cmp v0.5.7
github.com/hashicorp/go-version v1.4.0
github.com/hashicorp/hcl-lang v0.0.0-20211118124824-da3a292c5d7a
github.com/hashicorp/hcl-lang v0.0.0-20220316204834-49ffde67ce68
github.com/hashicorp/hcl/v2 v2.11.1
github.com/hashicorp/terraform-json v0.13.0
github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896
Expand Down
22 changes: 12 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09
github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.4.0 h1:aAQzgqIrRKRa7w75CKpbBxYsmUoPjzVm1W59ca1L0J4=
github.com/hashicorp/go-version v1.4.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/hcl-lang v0.0.0-20211118124824-da3a292c5d7a h1:NOcXX/HO5KHrQPjClxRuHO+Hu90CDhZqM5CNKvlcRkg=
github.com/hashicorp/hcl-lang v0.0.0-20211118124824-da3a292c5d7a/go.mod h1:0W3+VP07azoS+fCX5hWk1KxwHnqf1s9J7oBg2cFXm1c=
github.com/hashicorp/hcl/v2 v2.10.1/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg=
github.com/hashicorp/hcl-lang v0.0.0-20220315192528-7073d323da42 h1:99n2MNjdGqj772V2zszBlgqucTkfO50c2PKcmvbELCI=
github.com/hashicorp/hcl-lang v0.0.0-20220315192528-7073d323da42/go.mod h1:vyszbX6YNHCKIaVUhbh3LIZljxwYOtgWCIkhT5zKfjc=
github.com/hashicorp/hcl-lang v0.0.0-20220316204834-49ffde67ce68 h1:CdUL7gJYGdJheCfAmCWNE65wimdo9YWJSqB/+NtfWPc=
github.com/hashicorp/hcl-lang v0.0.0-20220316204834-49ffde67ce68/go.mod h1:oQgcOV8OizFyZfZh3FbQSsQtvtTv8hD23MLAxfn3E+E=
github.com/hashicorp/hcl/v2 v2.11.1 h1:yTyWcXcm9XB0TEkyU/JCRU6rYy4K+mgLtzn2wlrJbcc=
github.com/hashicorp/hcl/v2 v2.11.1/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg=
github.com/hashicorp/terraform-json v0.13.0 h1:Li9L+lKD1FO5RVFRM1mMMIBDoUHslOniyEi5CM+FWGY=
Expand Down Expand Up @@ -66,7 +67,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8=
github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
Expand All @@ -78,7 +79,7 @@ github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRK
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand All @@ -88,8 +89,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d h1:20cMwl2fHAzkJMEA+8J4JgqBQcQGzbisXo31MIeenXI=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -100,17 +101,18 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
6 changes: 4 additions & 2 deletions internal/schema/0.12/connection_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import (
"github.com/hashicorp/go-version"
"github.com/hashicorp/hcl-lang/lang"
"github.com/hashicorp/hcl-lang/schema"
"github.com/hashicorp/terraform-schema/internal/schema/tokmod"
"github.com/zclconf/go-cty/cty"
)

func connectionBlock(v *version.Version) *schema.BlockSchema {
return &schema.BlockSchema{
Description: lang.Markdown("Connection block describing how the provisioner connects to the given instance"),
MaxItems: 1,
Description: lang.Markdown("Connection block describing how the provisioner connects to the given instance"),
MaxItems: 1,
SemanticTokenModifier: tokmod.Connection,
Body: &schema.BodySchema{
HoverURL: "https://www.terraform.io/docs/language/resources/provisioners/connection.html",
Attributes: map[string]*schema.AttributeSchema{
Expand Down
16 changes: 10 additions & 6 deletions internal/schema/0.12/data_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/hashicorp/hcl-lang/lang"
"github.com/hashicorp/hcl-lang/schema"
"github.com/hashicorp/terraform-schema/internal/schema/refscope"
"github.com/hashicorp/terraform-schema/internal/schema/tokmod"
"github.com/zclconf/go-cty/cty"
)

Expand All @@ -22,16 +23,19 @@ func datasourceBlockSchema(v *version.Version) *schema.BlockSchema {
DependentBodyAsData: true,
InferDependentBody: true,
},
SemanticTokenModifier: tokmod.Data,
Labels: []*schema.LabelSchema{
{
Name: "type",
Description: lang.PlainText("Data Source Type"),
IsDepKey: true,
Completable: true,
Name: "type",
Description: lang.PlainText("Data Source Type"),
SemanticTokenModifier: lang.SemanticTokenModifier("type"),
IsDepKey: true,
Completable: true,
},
{
Name: "name",
Description: lang.PlainText("Reference Name"),
Name: "name",
Description: lang.PlainText("Reference Name"),
SemanticTokenModifier: lang.SemanticTokenModifier("name"),
},
},
Description: lang.PlainText("A data block requests that Terraform read from a given data source and export the result " +
Expand Down
2 changes: 2 additions & 0 deletions internal/schema/0.12/locals_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import (
"github.com/hashicorp/hcl-lang/lang"
"github.com/hashicorp/hcl-lang/schema"
"github.com/hashicorp/terraform-schema/internal/schema/refscope"
"github.com/hashicorp/terraform-schema/internal/schema/tokmod"
"github.com/zclconf/go-cty/cty"
)

var localsBlockSchema = &schema.BlockSchema{
SemanticTokenModifier: tokmod.Locals,
Description: lang.Markdown("Local values assigning names to expressions, so you can use these multiple times without repetition\n" +
"e.g. `service_name = \"forum\"`"),
Body: &schema.BodySchema{
Expand Down
7 changes: 5 additions & 2 deletions internal/schema/0.12/module_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/hashicorp/hcl-lang/lang"
"github.com/hashicorp/hcl-lang/schema"
"github.com/hashicorp/terraform-schema/internal/schema/refscope"
"github.com/hashicorp/terraform-schema/internal/schema/tokmod"
"github.com/zclconf/go-cty/cty"
)

Expand All @@ -17,10 +18,12 @@ var moduleBlockSchema = &schema.BlockSchema{
ScopeId: refscope.ModuleScope,
AsReference: true,
},
SemanticTokenModifier: tokmod.Module,
Labels: []*schema.LabelSchema{
{
Name: "name",
Description: lang.PlainText("Reference Name"),
Name: "name",
SemanticTokenModifier: tokmod.Name,
Description: lang.PlainText("Reference Name"),
},
},
Description: lang.PlainText("Module block to call a locally or remotely stored module"),
Expand Down
7 changes: 5 additions & 2 deletions internal/schema/0.12/output_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/hashicorp/hcl-lang/lang"
"github.com/hashicorp/hcl-lang/schema"
"github.com/hashicorp/terraform-schema/internal/schema/refscope"
"github.com/hashicorp/terraform-schema/internal/schema/tokmod"
"github.com/zclconf/go-cty/cty"
)

Expand All @@ -17,10 +18,12 @@ var outputBlockSchema = &schema.BlockSchema{
ScopeId: refscope.OutputScope,
AsReference: true,
},
SemanticTokenModifier: tokmod.Output,
Labels: []*schema.LabelSchema{
{
Name: "name",
Description: lang.PlainText("Output Name"),
Name: "name",
SemanticTokenModifier: tokmod.Name,
Description: lang.PlainText("Output Name"),
},
},
Description: lang.PlainText("Output value for consumption by another module or a human interacting via the UI"),
Expand Down
11 changes: 7 additions & 4 deletions internal/schema/0.12/provider_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/hashicorp/hcl-lang/lang"
"github.com/hashicorp/hcl-lang/schema"
"github.com/hashicorp/terraform-schema/internal/schema/refscope"
"github.com/hashicorp/terraform-schema/internal/schema/tokmod"
"github.com/zclconf/go-cty/cty"
)

Expand All @@ -19,12 +20,14 @@ func providerBlockSchema(v *version.Version) *schema.BlockSchema {
ScopeId: refscope.ProviderScope,
AsReference: true,
},
SemanticTokenModifier: tokmod.Provider,
Labels: []*schema.LabelSchema{
{
Name: "name",
Description: lang.PlainText("Provider Name"),
IsDepKey: true,
Completable: true,
Name: "name",
SemanticTokenModifier: tokmod.Name,
Description: lang.PlainText("Provider Name"),
IsDepKey: true,
Completable: true,
},
},
Description: lang.PlainText("A provider block is used to specify a provider configuration"),
Expand Down
11 changes: 7 additions & 4 deletions internal/schema/0.12/provisioner_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ import (
"github.com/hashicorp/go-version"
"github.com/hashicorp/hcl-lang/lang"
"github.com/hashicorp/hcl-lang/schema"
"github.com/hashicorp/terraform-schema/internal/schema/tokmod"
)

func provisionerBlock(v *version.Version) *schema.BlockSchema {
return &schema.BlockSchema{
SemanticTokenModifier: tokmod.Provisioner,
Description: lang.Markdown("Provisioner to model specific actions on the local machine or on a remote machine " +
"in order to prepare servers or other infrastructure objects for service"),
Labels: []*schema.LabelSchema{
{
Name: "type",
Description: lang.PlainText("Type of provisioner to use, e.g. `remote-exec` or `file`"),
IsDepKey: true,
Completable: true,
Name: "type",
SemanticTokenModifier: tokmod.Type,
Description: lang.PlainText("Type of provisioner to use, e.g. `remote-exec` or `file`"),
IsDepKey: true,
Completable: true,
},
},
Body: &schema.BodySchema{
Expand Down
16 changes: 10 additions & 6 deletions internal/schema/0.12/resource_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/hashicorp/hcl-lang/lang"
"github.com/hashicorp/hcl-lang/schema"
"github.com/hashicorp/terraform-schema/internal/schema/refscope"
"github.com/hashicorp/terraform-schema/internal/schema/tokmod"
"github.com/zclconf/go-cty/cty"
)

Expand All @@ -21,16 +22,19 @@ func resourceBlockSchema(v *version.Version) *schema.BlockSchema {
DependentBodyAsData: true,
InferDependentBody: true,
},
SemanticTokenModifier: tokmod.Resource,
Labels: []*schema.LabelSchema{
{
Name: "type",
Description: lang.PlainText("Resource Type"),
IsDepKey: true,
Completable: true,
Name: "type",
SemanticTokenModifier: tokmod.Type,
Description: lang.PlainText("Resource Type"),
IsDepKey: true,
Completable: true,
},
{
Name: "name",
Description: lang.PlainText("Reference Name"),
Name: "name",
SemanticTokenModifier: tokmod.Name,
Description: lang.PlainText("Reference Name"),
},
},
Description: lang.PlainText("A resource block declares a resource of a given type with a given local name. The name is " +
Expand Down
17 changes: 11 additions & 6 deletions internal/schema/0.12/terraform_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import (
"github.com/hashicorp/hcl-lang/schema"
"github.com/hashicorp/terraform-schema/internal/schema/backends"
"github.com/hashicorp/terraform-schema/internal/schema/refscope"
"github.com/hashicorp/terraform-schema/internal/schema/tokmod"
"github.com/zclconf/go-cty/cty"
)

func terraformBlockSchema(v *version.Version) *schema.BlockSchema {
bs := &schema.BlockSchema{
Description: lang.Markdown("Terraform block used to configure some high-level behaviors of Terraform"),
SemanticTokenModifier: tokmod.Terraform,
Description: lang.Markdown("Terraform block used to configure some high-level behaviors of Terraform"),
Body: &schema.BodySchema{
Attributes: map[string]*schema.AttributeSchema{
"required_version": {
Expand All @@ -23,21 +25,24 @@ func terraformBlockSchema(v *version.Version) *schema.BlockSchema {
},
Blocks: map[string]*schema.BlockSchema{
"backend": {
SemanticTokenModifier: tokmod.Backend,
Description: lang.Markdown("Backend configuration which defines exactly where and how " +
"operations are performed, where state snapshots are stored, etc."),
Labels: []*schema.LabelSchema{
{
Name: "backend type",
Description: lang.Markdown("Backend type"),
IsDepKey: true,
Completable: true,
Name: "backend type",
SemanticTokenModifier: tokmod.Type,
Description: lang.Markdown("Backend type"),
IsDepKey: true,
Completable: true,
},
},
MaxItems: 1,
DependentBody: backends.ConfigsAsDependentBodies(v),
},
"required_providers": {
Description: lang.Markdown("What provider version to use within this configuration"),
SemanticTokenModifier: tokmod.RequiredProviders,
Description: lang.Markdown("What provider version to use within this configuration"),
Body: &schema.BodySchema{
AnyAttribute: &schema.AttributeSchema{
Expr: schema.LiteralTypeOnly(cty.String),
Expand Down
7 changes: 5 additions & 2 deletions internal/schema/0.12/variable_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/hashicorp/hcl-lang/lang"
"github.com/hashicorp/hcl-lang/schema"
"github.com/hashicorp/terraform-schema/internal/schema/refscope"
"github.com/hashicorp/terraform-schema/internal/schema/tokmod"
"github.com/zclconf/go-cty/cty"
)

Expand All @@ -23,10 +24,12 @@ func variableBlockSchema(v *version.Version) *schema.BlockSchema {
AttributeValue: "default",
},
},
SemanticTokenModifier: tokmod.Variable,
Labels: []*schema.LabelSchema{
{
Name: "name",
Description: lang.PlainText("Variable Name"),
Name: "name",
SemanticTokenModifier: tokmod.Name,
Description: lang.PlainText("Variable Name"),
},
},
Description: lang.Markdown("Input variable allowing users to customizate aspects of the configuration when used directly " +
Expand Down
7 changes: 5 additions & 2 deletions internal/schema/0.13/module_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/zclconf/go-cty/cty"

"github.com/hashicorp/terraform-schema/internal/schema/refscope"
"github.com/hashicorp/terraform-schema/internal/schema/tokmod"
)

var moduleBlockSchema = &schema.BlockSchema{
Expand All @@ -18,10 +19,12 @@ var moduleBlockSchema = &schema.BlockSchema{
ScopeId: refscope.ModuleScope,
AsReference: true,
},
SemanticTokenModifier: tokmod.Module,
Labels: []*schema.LabelSchema{
{
Name: "name",
Description: lang.PlainText("Reference Name"),
Name: "name",
SemanticTokenModifier: tokmod.Name,
Description: lang.PlainText("Reference Name"),
},
},
Description: lang.PlainText("Module block to call a locally or remotely stored module"),
Expand Down
11 changes: 7 additions & 4 deletions internal/schema/0.13/provider_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/zclconf/go-cty/cty"

"github.com/hashicorp/terraform-schema/internal/schema/refscope"
"github.com/hashicorp/terraform-schema/internal/schema/tokmod"
)

var providerBlockSchema = &schema.BlockSchema{
Expand All @@ -18,12 +19,14 @@ var providerBlockSchema = &schema.BlockSchema{
ScopeId: refscope.ProviderScope,
AsReference: true,
},
SemanticTokenModifier: tokmod.Provider,
Labels: []*schema.LabelSchema{
{
Name: "name",
Description: lang.PlainText("Provider Name"),
IsDepKey: true,
Completable: true,
Name: "name",
SemanticTokenModifier: tokmod.Name,
Description: lang.PlainText("Provider Name"),
IsDepKey: true,
Completable: true,
},
},
Description: lang.PlainText("A provider block is used to specify a provider configuration"),
Expand Down
Loading