Skip to content

Commit

Permalink
fix(hcl): don't parse expressions containing on open curly brace as b…
Browse files Browse the repository at this point in the history
…locks
  • Loading branch information
ansgarm committed Sep 17, 2024
1 parent 2eeee06 commit 7351a22
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
6 changes: 3 additions & 3 deletions syntaxes/hcl.tmGrammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions tests/snapshot/hcl/block_labels.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ block-single-char-indentifier-newline a {
byte_match_statement_rules = local.enabled && var.byte_match_statement_rules != null ? {
}

# braces are fun (now)
a = not_a_block == "{"
brace_label "{" {}
path "secrets/data/users/{{identity.entity.name}}/*" {
capabilities = ["create", "update", "patch", "read", "delete", "list"]
}
Expand Down
12 changes: 12 additions & 0 deletions tests/snapshot/hcl/block_labels.hcl.snap
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,18 @@
>}
#^ source.hcl meta.braces.hcl punctuation.section.braces.end.hcl
>
>a = not_a_block == "{"
#^ source.hcl variable.declaration.hcl variable.other.readwrite.hcl
# ^ source.hcl variable.declaration.hcl
# ^ source.hcl variable.declaration.hcl keyword.operator.assignment.hcl
# ^ source.hcl variable.declaration.hcl
# ^^^^^^^^^^^^ source.hcl
# ^^ source.hcl keyword.operator.hcl
# ^ source.hcl
# ^ source.hcl string.quoted.double.hcl punctuation.definition.string.begin.hcl
# ^ source.hcl string.quoted.double.hcl
# ^ source.hcl string.quoted.double.hcl punctuation.definition.string.end.hcl
>
>path "secrets/data/users/{{identity.entity.name}}/*" {
#^^^^ source.hcl meta.block.hcl entity.name.type.hcl
# ^ source.hcl meta.block.hcl
Expand Down

0 comments on commit 7351a22

Please sign in to comment.