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 => #115

Merged
merged 2 commits into from
Mar 25, 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: 2 additions & 0 deletions src/_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ repository:
name: keyword.operator.hcl
- match: "\\:"
name: keyword.operator.hcl
- match: \=\>
name: keyword.operator.hcl
brackets:
begin: \[
beginCaptures:
Expand Down
4 changes: 4 additions & 0 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 syntaxes/terraform.tmGrammar.json

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

7 changes: 7 additions & 0 deletions tests/snapshot/hcl/issue114.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
byte_match_statement_rules = local.enabled && var.byte_match_statement_rules != null ? {
for rule in flatten(var.byte_match_statement_rules) :
format("%s-%s",
lookup(rule, "name", null) != null ? rule.name : format("%s-byte-match-%d", module.this.id, rule.priority),
rule.action,
) => rule
} : {}
96 changes: 96 additions & 0 deletions tests/snapshot/hcl/issue114.hcl.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
>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 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 variable.other.enummember.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 variable.other.enummember.hcl
# ^^^ source.hcl meta.block.hcl
# ^ source.hcl meta.block.hcl punctuation.section.block.begin.hcl
> for rule in flatten(var.byte_match_statement_rules) :
#^^^^^^^^^^^^^^ source.hcl meta.block.hcl
# ^^^^^^^ source.hcl meta.block.hcl meta.function-call.hcl support.function.builtin.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl punctuation.section.parens.begin.hcl
# ^^^ source.hcl meta.block.hcl meta.function-call.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl keyword.operator.accessor.hcl
# ^^^^^^^^^^^^^^^^^^^^^^^^^^ source.hcl meta.block.hcl meta.function-call.hcl variable.other.member.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl punctuation.section.parens.end.hcl
# ^ source.hcl meta.block.hcl
# ^ source.hcl meta.block.hcl keyword.operator.hcl
> format("%s-%s",
#^^^^ source.hcl meta.block.hcl
# ^^^^^^ source.hcl meta.block.hcl meta.function-call.hcl support.function.builtin.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl punctuation.section.parens.begin.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl string.quoted.double.hcl punctuation.definition.string.begin.hcl
# ^^^^^ source.hcl meta.block.hcl meta.function-call.hcl string.quoted.double.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl string.quoted.double.hcl punctuation.definition.string.end.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl punctuation.separator.hcl
> lookup(rule, "name", null) != null ? rule.name : format("%s-byte-match-%d", module.this.id, rule.priority),
#^^^^^^ source.hcl meta.block.hcl meta.function-call.hcl
# ^^^^^^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl support.function.builtin.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl punctuation.section.parens.begin.hcl
# ^^^^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl punctuation.separator.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl string.quoted.double.hcl punctuation.definition.string.begin.hcl
# ^^^^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl string.quoted.double.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl string.quoted.double.hcl punctuation.definition.string.end.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl punctuation.separator.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl
# ^^^^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl constant.language.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl punctuation.section.parens.end.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl
# ^^ source.hcl meta.block.hcl meta.function-call.hcl keyword.operator.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl
# ^^^^ source.hcl meta.block.hcl meta.function-call.hcl constant.language.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl keyword.operator.hcl
# ^^^^^ source.hcl meta.block.hcl meta.function-call.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl keyword.operator.accessor.hcl
# ^^^^ source.hcl meta.block.hcl meta.function-call.hcl variable.other.member.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl keyword.operator.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl
# ^^^^^^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl support.function.builtin.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl punctuation.section.parens.begin.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl string.quoted.double.hcl punctuation.definition.string.begin.hcl
# ^^^^^^^^^^^^^^^^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl string.quoted.double.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl string.quoted.double.hcl punctuation.definition.string.end.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl punctuation.separator.hcl
# ^^^^^^^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl keyword.operator.accessor.hcl
# ^^^^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl variable.other.member.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl keyword.operator.accessor.hcl
# ^^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl variable.other.member.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl punctuation.separator.hcl
# ^^^^^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl keyword.operator.accessor.hcl
# ^^^^^^^^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl variable.other.member.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl meta.function-call.hcl punctuation.section.parens.end.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl punctuation.separator.hcl
> rule.action,
#^^^^^^^^^^ source.hcl meta.block.hcl meta.function-call.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl keyword.operator.accessor.hcl
# ^^^^^^ source.hcl meta.block.hcl meta.function-call.hcl variable.other.member.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl punctuation.separator.hcl
> ) => rule
#^^^^ source.hcl meta.block.hcl meta.function-call.hcl
# ^ source.hcl meta.block.hcl meta.function-call.hcl punctuation.section.parens.end.hcl
# ^ source.hcl meta.block.hcl
# ^^ source.hcl meta.block.hcl keyword.operator.hcl
# ^^^^^^ source.hcl meta.block.hcl
> } : {}
#^^ source.hcl meta.block.hcl
# ^ source.hcl meta.block.hcl punctuation.section.block.end.hcl
# ^ source.hcl
# ^ source.hcl keyword.operator.hcl
# ^ source.hcl
# ^ source.hcl meta.braces.hcl punctuation.section.braces.begin.hcl
# ^ source.hcl meta.braces.hcl punctuation.section.braces.end.hcl
Loading