Skip to content

Commit 43f59db

Browse files
committed
Activate the prototype context
Thanks, @keith-hall
1 parent 4ea88b4 commit 43f59db

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

PowerShell.sublime-syntax

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ contexts:
8484
scope: keyword.declaration.parameter.powershell # This scope is not standard
8585

8686
expressions:
87-
# BUG: When we figure out what's wrong with `prototype`, remove this.
88-
- include: comments
87+
- include: regions
88+
- include: requires-directives
8989

9090
- include: commands
9191
- include: constants
@@ -117,6 +117,7 @@ contexts:
117117
- match: \B--%\B
118118
scope: keyword.control.powershell
119119
push:
120+
- meta_include_prototype: false
120121
- meta_content_scope: string.unquoted.powershell
121122
- include: pop-before-eol
122123

@@ -135,6 +136,37 @@ contexts:
135136
2: keyword.other.powershell
136137
3: variable.parameter.powershell
137138

139+
requires-directives:
140+
- match: (#)((?i:requires))\s
141+
captures:
142+
1: punctuation.definition.keyword.powershell
143+
2: keyword.control.import.require.powershell
144+
push:
145+
- meta_scope: meta.requires.powershell
146+
- include: pop-eol
147+
- include: hashtables
148+
- match: (-)(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version)
149+
scope: variable.parameter.option.powershell
150+
captures:
151+
1: punctuation.definition.variable.powershell
152+
- match: ','
153+
scope: punctuation.separator.powershell
154+
155+
regions:
156+
- match: ^\s*((#)\s*(region\b)(?:\s*(\S.*))?(\n?))
157+
captures:
158+
1: comment.line.powershell
159+
2: punctuation.definition.comment.powershell
160+
3: keyword.other.region.begin.powershell
161+
4: meta.toc-list.powershell entity.name.section.powershell
162+
5: meta.fold.begin.powershell
163+
- match: ^\s*((#)\s*(endregion\b).*(\n?))
164+
captures:
165+
1: comment.line.powershell
166+
2: punctuation.definition.comment.powershell
167+
3: keyword.other.region.end.powershell
168+
4: meta.fold.end.powershell
169+
138170
attributes:
139171
- match: |-
140172
(?xi:
@@ -716,6 +748,7 @@ contexts:
716748
scope: punctuation.section.interpolation.begin.powershell
717749
push:
718750
- clear_scopes: 1
751+
- meta_include_prototype: false
719752
- meta_scope: meta.interpolation.powershell
720753
- meta_content_scope: source.powershell.embedded
721754
- match: \)
@@ -725,6 +758,7 @@ contexts:
725758
- match: (?=\$)
726759
push:
727760
- clear_scopes: 1
761+
- meta_include_prototype: false
728762
- meta_scope: meta.interpolation.powershell
729763
- include: variables-without-property
730764
- include: variables
@@ -790,8 +824,6 @@ contexts:
790824
###[ COMMENTS ]################################################################
791825

792826
comments:
793-
- include: regions
794-
- include: requires-directives
795827
- include: comment-block
796828
- include: comment-line
797829

@@ -835,45 +867,13 @@ contexts:
835867
3: markup.underline.link.powershell
836868

837869
comment-line:
838-
- match: '#'
870+
- match: '#(?!(?i:requires|(?:end)?region)\b)'
839871
scope: punctuation.definition.comment.powershell
840872
push:
841873
- meta_scope: comment.line.powershell
842874
- include: pop-eol
843875
- include: comment-embedded-docs
844876

845-
regions:
846-
- match: ^\s*((#)\s*(region\b)(?:\s*(\S.*))?(\n?))
847-
captures:
848-
1: comment.line.powershell
849-
2: punctuation.definition.comment.powershell
850-
3: keyword.other.region.begin.powershell
851-
4: meta.toc-list.powershell entity.name.section.powershell
852-
5: meta.fold.begin.powershell
853-
- match: ^\s*((#)\s*(endregion\b).*(\n?))
854-
captures:
855-
1: comment.line.powershell
856-
2: punctuation.definition.comment.powershell
857-
3: keyword.other.region.end.powershell
858-
4: meta.fold.end.powershell
859-
860-
requires-directives:
861-
# TODO: add back `(?<=#)`-equivalent match
862-
- match: (#)((?i:requires))\s
863-
captures:
864-
1: punctuation.definition.keyword.powershell
865-
2: keyword.control.import.require.powershell
866-
push:
867-
- meta_scope: meta.requires.powershell
868-
- include: pop-eol
869-
- include: hashtables
870-
- match: (-)(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version)
871-
scope: variable.parameter.option.powershell
872-
captures:
873-
1: punctuation.definition.variable.powershell
874-
- match: ','
875-
scope: punctuation.separator.powershell
876-
877877
###[ COMPONENTS ]##############################################################
878878

879879
escape-sequences:

0 commit comments

Comments
 (0)