Skip to content

Commit 518098e

Browse files
jpogranradeksimko
andauthored
Apply suggestions from code review
Co-authored-by: Radek Simko <[email protected]>
1 parent 64a478c commit 518098e

File tree

5 files changed

+3
-13
lines changed

5 files changed

+3
-13
lines changed

decoder/body_candidates.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ func (d *PathDecoder) bodySchemaCandidates(body *hclsyntax.Body, schema *schema.
1818
count := 0
1919

2020
if schema.Extensions != nil {
21-
// check if this schema supports Count attribute
21+
// check if count attribute "extension" is enabled here
2222
if schema.Extensions.Count {
23-
// check if Count is already used inside this body, so we don't
23+
// check if count attribute is already declared, so we don't
2424
// suggest a duplicate
2525
if _, ok := body.Attributes["count"]; !ok {
2626
candidates.List = append(candidates.List, countAttributeCandidate(editRng))

decoder/hover_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/google/go-cmp/cmp"
1111
"github.com/zclconf/go-cty-debug/ctydebug"
1212
"github.com/zclconf/go-cty/cty"
13-
1413
"github.com/hashicorp/hcl-lang/lang"
1514
"github.com/hashicorp/hcl-lang/schema"
1615
"github.com/hashicorp/hcl/v2"
@@ -935,7 +934,7 @@ func TestDecoder_HoverAtPos_typeDeclaration(t *testing.T) {
935934
}
936935
}
937936

938-
func TestDecoder_HoverAtPos_expression_extension(t *testing.T) {
937+
func TestDecoder_HoverAtPos_extension(t *testing.T) {
939938
resourceLabelSchema := []*schema.LabelSchema{
940939
{Name: "type", IsDepKey: true},
941940
{Name: "name"},

decoder/semantic_tokens.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"sort"
66

77
"github.com/zclconf/go-cty/cty"
8-
98
icontext "github.com/hashicorp/hcl-lang/context"
109
"github.com/hashicorp/hcl-lang/lang"
1110
"github.com/hashicorp/hcl-lang/reference"
@@ -62,10 +61,6 @@ func (d *PathDecoder) tokensForBody(ctx context.Context, body *hclsyntax.Body, b
6261
if !ok {
6362
if bodySchema.Extensions != nil && name == "count" && bodySchema.Extensions.Count {
6463
attrSchema = &schema.AttributeSchema{
65-
Description: lang.MarkupContent{
66-
Kind: lang.MarkdownKind,
67-
Value: "**count** _optional, number_\n\nThe distinct index number (starting with 0) corresponding to the instance",
68-
},
6964
IsOptional: true,
7065
Expr: schema.LiteralTypeOnly(cty.Number),
7166
}

decoder/semantic_tokens_expr_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77

88
"github.com/google/go-cmp/cmp"
99
"github.com/zclconf/go-cty/cty"
10-
1110
"github.com/hashicorp/hcl-lang/lang"
1211
"github.com/hashicorp/hcl-lang/reference"
1312
"github.com/hashicorp/hcl-lang/schema"

schema/body_schema.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ type BodySchema struct {
5252

5353
type BodyExtensions struct {
5454
Count bool // count attribute + count.index refs
55-
ForEach bool // for_each attribute + each.* refs
56-
DynamicBlocks bool // dynamic "block-name" w/ content & for_each inside
57-
SelfRefs bool // self.* refs which refer to outermost parent block body
5855
}
5956

6057
func (be *BodyExtensions) Copy() *BodyExtensions {

0 commit comments

Comments
 (0)