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

Fix highlighting for computed map keys #8

Merged
merged 2 commits into from
Mar 15, 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 syntaxes/hcl.tmGrammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@
"name": "punctuation.section.parens.begin.hcl"
}
},
"end": "(\\))\\s*(\\=)\\s*",
"end": "(\\))\\s*(=|:)\\s*",
"endCaptures": {
"1": {
"name": "punctuation.section.parens.end.hcl"
Expand Down
10 changes: 10 additions & 0 deletions tests/snapshot/hcl/issue809.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
locals {
key_name = "testing"
test_example = {
(local.key_name): "test"
}
}

variable "test" {
default = "test"
}
55 changes: 55 additions & 0 deletions tests/snapshot/hcl/issue809.hcl.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
>locals {
#^^^^^^ source.hcl meta.block.hcl entity.name.type.hcl
# ^ source.hcl meta.block.hcl
# ^ source.hcl meta.block.hcl punctuation.section.block.begin.hcl
> key_name = "testing"
#^^ source.hcl meta.block.hcl
# ^^^^^^^^ source.hcl meta.block.hcl variable.declaration.hcl variable.other.readwrite.hcl
# ^ source.hcl meta.block.hcl variable.declaration.hcl
# ^ source.hcl meta.block.hcl variable.declaration.hcl keyword.operator.assignment.hcl
# ^ source.hcl meta.block.hcl variable.declaration.hcl
# ^ source.hcl meta.block.hcl string.quoted.double.hcl punctuation.definition.string.begin.hcl
# ^^^^^^^ source.hcl meta.block.hcl string.quoted.double.hcl
# ^ source.hcl meta.block.hcl string.quoted.double.hcl punctuation.definition.string.end.hcl
> test_example = {
#^^ source.hcl meta.block.hcl
# ^^^^^^^^^^^^ source.hcl meta.block.hcl variable.declaration.hcl variable.other.readwrite.hcl
# ^ source.hcl meta.block.hcl variable.declaration.hcl
# ^ source.hcl meta.block.hcl variable.declaration.hcl keyword.operator.assignment.hcl
# ^ source.hcl meta.block.hcl variable.declaration.hcl
# ^ source.hcl meta.block.hcl meta.braces.hcl punctuation.section.braces.begin.hcl
> (local.key_name): "test"
#^^^^^ source.hcl meta.block.hcl meta.braces.hcl meta.mapping.key.hcl punctuation.section.parens.begin.hcl
# ^^^^^ source.hcl meta.block.hcl meta.braces.hcl meta.mapping.key.hcl
# ^ source.hcl meta.block.hcl meta.braces.hcl meta.mapping.key.hcl keyword.operator.accessor.hcl
# ^^^^^^^^ source.hcl meta.block.hcl meta.braces.hcl meta.mapping.key.hcl variable.other.member.hcl
# ^ source.hcl meta.block.hcl meta.braces.hcl meta.mapping.key.hcl punctuation.section.parens.end.hcl
# ^ source.hcl meta.block.hcl meta.braces.hcl meta.mapping.key.hcl keyword.operator.hcl
# ^ source.hcl meta.block.hcl meta.braces.hcl meta.mapping.key.hcl
# ^ source.hcl meta.block.hcl meta.braces.hcl string.quoted.double.hcl punctuation.definition.string.begin.hcl
# ^^^^ source.hcl meta.block.hcl meta.braces.hcl string.quoted.double.hcl
# ^ source.hcl meta.block.hcl meta.braces.hcl string.quoted.double.hcl punctuation.definition.string.end.hcl
> }
#^^ source.hcl meta.block.hcl meta.braces.hcl
# ^ source.hcl meta.block.hcl meta.braces.hcl punctuation.section.braces.end.hcl
>}
#^ source.hcl meta.block.hcl punctuation.section.block.end.hcl
>
>variable "test" {
#^^^^^^^^ source.hcl meta.block.hcl entity.name.type.hcl
# ^ source.hcl meta.block.hcl
# ^^^^^^ source.hcl meta.block.hcl variable.other.enummember.hcl
# ^ source.hcl meta.block.hcl
# ^ source.hcl meta.block.hcl punctuation.section.block.begin.hcl
> default = "test"
#^^ source.hcl meta.block.hcl
# ^^^^^^^ source.hcl meta.block.hcl variable.declaration.hcl variable.other.readwrite.hcl
# ^ source.hcl meta.block.hcl variable.declaration.hcl
# ^ source.hcl meta.block.hcl variable.declaration.hcl keyword.operator.assignment.hcl
# ^ source.hcl meta.block.hcl variable.declaration.hcl
# ^ source.hcl meta.block.hcl string.quoted.double.hcl punctuation.definition.string.begin.hcl
# ^^^^ source.hcl meta.block.hcl string.quoted.double.hcl
# ^ source.hcl meta.block.hcl string.quoted.double.hcl punctuation.definition.string.end.hcl
>}
#^ source.hcl meta.block.hcl punctuation.section.block.end.hcl
>