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 mis-highlight for conditionals detected as a block #116

Merged
merged 2 commits into from
Mar 26, 2024
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 src/_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ repository:
block:
name: meta.block.hcl
comment: This will match HCL blocks like `thing1 "one" "two" {` or `thing2 {`
begin: ([\w][\-\w]*)([^{\r\n]*)(\{)
begin: ([\w][\-\w]*)([^?{\r\n]*)(\{)
beginCaptures:
"1":
patterns:
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/hcl.tmGrammar.json

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

2 changes: 2 additions & 0 deletions tests/snapshot/hcl/block_labels.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ blockempty-newline "" {
block-single-char-indentifier a {}
block-single-char-indentifier-newline a {
}

byte_match_statement_rules = local.enabled && var.byte_match_statement_rules != null ? {
23 changes: 22 additions & 1 deletion tests/snapshot/hcl/block_labels.hcl.snap
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,25 @@
# ^ source.hcl meta.block.hcl punctuation.section.block.begin.hcl
>}
#^ source.hcl meta.block.hcl punctuation.section.block.end.hcl
>
>
>byte_match_statement_rules = local.enabled && var.byte_match_statement_rules != null ? {
#^^^^^^^^^^^^^^^^^^^^^^^^^^ 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.accessor.hcl
# ^^^^^^^ source.hcl variable.other.member.hcl
# ^ source.hcl
# ^^ source.hcl keyword.operator.logical.hcl
# ^^^^ source.hcl
# ^ source.hcl keyword.operator.accessor.hcl
# ^^^^^^^^^^^^^^^^^^^^^^^^^^ source.hcl variable.other.member.hcl
# ^ source.hcl
# ^^ source.hcl keyword.operator.hcl
# ^ source.hcl
# ^^^^ source.hcl constant.language.hcl
# ^ source.hcl
# ^ source.hcl keyword.operator.hcl
# ^ source.hcl
# ^ source.hcl meta.braces.hcl punctuation.section.braces.begin.hcl
Loading
Loading