Skip to content
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
19 changes: 12 additions & 7 deletions PowerShell.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contexts:
main:
- meta_include_prototype: false
- match: ''
push: [statements, imports, shebang]
push: [statements, script-param-block, imports, shebang]

shebang:
- meta_include_prototype: false
Expand All @@ -46,6 +46,11 @@ contexts:
- include: using-directives
- include: else-pop

script-param-block:
- include: attributes
- include: param-block
- include: else-pop

statements:
- include: classes
- include: functions
Expand Down Expand Up @@ -591,21 +596,21 @@ contexts:
attributes:
- match: (\[)\s*(ValidatePattern)
captures:
1: punctuation.section.brackets.begin.powershell
2: support.function.attribute.powershell
1: punctuation.definition.annotation.begin.powershell
2: variable.annotation.powershell
push: inside-attribute
with_prototype:
- include: regex-strings
- match: (\[)\s*({{attributes}})
captures:
1: punctuation.section.brackets.begin.powershell
2: support.function.attribute.powershell
1: punctuation.definition.annotation.begin.powershell
2: variable.annotation.powershell
push: inside-attribute

inside-attribute:
- meta_scope: meta.attribute.powershell
- meta_scope: meta.annotation.powershell
- match: \]
scope: punctuation.section.brackets.end.powershell
scope: punctuation.definition.annotation.end.powershell
pop: 1
- match: \(
scope: punctuation.section.group.begin.powershell
Expand Down
10 changes: 5 additions & 5 deletions tests/syntax_test_Class.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ class TypeName
# <- punctuation.definition.comment
# ^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line
[ValidateSet("val1", "Val2")]
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute.powershell
# ^ punctuation.section.brackets.begin.powershell
# ^^^^^^^^^^^ support.function.attribute.powershell
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation.powershell
# ^ punctuation.definition.annotation.begin.powershell
# ^^^^^^^^^^^ variable.annotation.powershell
# ^ punctuation.section.group.begin.powershell
# ^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
# ^ punctuation.definition.string.begin.powershell
Expand All @@ -44,7 +44,7 @@ class TypeName
# ^ punctuation.definition.string.begin.powershell
# ^ punctuation.definition.string.end.powershell
# ^ punctuation.section.group.end.powershell
# ^ punctuation.section.brackets.end.powershell
# ^ punctuation.definition.annotation.end.powershell
[string] $P1
#^^^^^^^^^^^^^^^ meta.class.powershell
# ^ punctuation.section.brackets.begin.powershell
Expand Down
Loading