Skip to content

Commit 36124ea

Browse files
committed
Highlight stray closing punctuation
1 parent 80c2f98 commit 36124ea

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

Terraform.sublime-syntax

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ contexts:
160160
- include: functions
161161
- include: parens
162162
- include: identifiers
163+
- include: illegal-strays
163164

164165
comma:
165166
- match: \,
@@ -517,7 +518,6 @@ contexts:
517518
# https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#collection-values
518519
object-value:
519520
- include: comments
520-
- include: expressions
521521
- match: \,
522522
comment: Pop scope on comma.
523523
scope: punctuation.separator.terraform
@@ -529,6 +529,7 @@ contexts:
529529
comment: Lookahead (don't consume) and pop scope on a bracket.
530530
scope: punctuation.section.braces.end.terraform
531531
pop: 1
532+
- include: expressions
532533

533534
# Attribute Access: "." Identifier
534535
#
@@ -692,6 +693,10 @@ contexts:
692693
- match: '{{identifier}}'
693694
scope: variable.other.readwrite.terraform
694695

696+
illegal-strays:
697+
- match: '[\])}]'
698+
scope: invalid.illegal.stray.python
699+
695700
# Blocks: Identifier (StringLit|Identifier)* "{" Newline Body "}" Newline;
696701
#
697702
# https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#structural-elements

tests/syntax_test_scope.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3439,3 +3439,12 @@ resource "aws_iam_role_policy" "attach-inline-policy-1" {
34393439
]
34403440
})
34413441
}
3442+
3443+
]
3444+
# <- invalid.illegal.stray.python
3445+
3446+
}
3447+
# <- invalid.illegal.stray.python
3448+
3449+
)
3450+
# <- invalid.illegal.stray.python

0 commit comments

Comments
 (0)