@@ -63,6 +63,84 @@ contexts:
6363 scope : punctuation.separator.argument.pipeline
6464 - include : inside-expression
6565
66+ # ##[ POWERSHELL SCRIPT BLOCKS ]################################################
67+
68+ pwsh-block-node :
69+ - meta_scope : meta.block.pwsh.pipeline
70+ - include : pwsh-block-scalar
71+ - include : flow-scalar-pwsh-out
72+
73+ pwsh-block-scalar :
74+ # http://www.yaml.org/spec/1.2/spec.html#style/block/scalar
75+ # c-l+folded(n)
76+ - match : (>)([1-9])?([-+]?) # c-b-block-header(m,t)
77+ captures :
78+ 1 : keyword.control.flow.block-scalar.folded.yaml
79+ 2 : constant.numeric.indentation-indicator.yaml
80+ 3 : storage.modifier.chomping-indicator.yaml
81+ set : pwsh-block-folded-scalar-begin
82+ # c-l+literal(n)
83+ - match : (\|)([1-9])?([-+]?) # c-b-block-header(m,t)
84+ captures :
85+ 1 : keyword.control.flow.block-scalar.literal.yaml
86+ 2 : constant.numeric.indentation-indicator.yaml
87+ 3 : storage.modifier.chomping-indicator.yaml
88+ set : pwsh-block-scalar-begin
89+
90+ flow-scalar-pwsh-out :
91+ # double quoted scalar
92+ - match : \"
93+ scope : meta.string.yaml string.quoted.double.yaml punctuation.definition.string.begin.yaml
94+ embed : embedded-pwsh-folded
95+ embed_scope : meta.string.yaml
96+ escape : \"
97+ escape_captures :
98+ 0 : meta.string.yaml string.quoted.double.yaml punctuation.definition.string.end.yaml
99+ pop : 1
100+ # single quoted scalar
101+ - match : \'
102+ scope : meta.string.yaml string.quoted.single.yaml punctuation.definition.string.begin.yaml
103+ embed : embedded-pwsh-folded
104+ embed_scope : meta.string.yaml
105+ escape : \'
106+ escape_captures :
107+ 0 : meta.string.yaml string.quoted.single.yaml punctuation.definition.string.end.yaml
108+ pop : 1
109+ # unquoted scalar
110+ - match : (?={{ns_plain_first_plain_out}})
111+ embed : embedded-pwsh-folded
112+ embed_scope : meta.string.yaml
113+ escape : ' {{_flow_scalar_end_plain_out}}'
114+ pop : 1
115+
116+ pwsh-block-scalar-begin :
117+ - meta_include_prototype : false
118+ - include : comment
119+ - match : ^([ ]+)(?! ) # match first non-empty line to determine indentation level
120+ scope : source.powershell.embedded
121+ # note that we do not check if indentation is enough
122+ embed : embedded-pwsh
123+ escape : ^(?!\1|\s*$)
124+ pop : 1
125+ - match : ^(?=\S) # the block is empty
126+ pop : 1
127+ - match : .+
128+ scope : invalid.illegal.expected-comment-or-newline.yaml
129+
130+ pwsh-block-folded-scalar-begin :
131+ - meta_include_prototype : false
132+ - include : comment
133+ - match : ^([ ]+)(?! ) # match first non-empty line to determine indentation level
134+ scope : source.powershell.embedded
135+ # note that we do not check if indentation is enough
136+ embed : embedded-pwsh-folded
137+ escape : ^(?!\1|\s*$)
138+ pop : 1
139+ - match : ^(?=\S) # the block is empty
140+ pop : 1
141+ - match : .+
142+ scope : invalid.illegal.expected-comment-or-newline.yaml
143+
66144# ##[ SHELLSCRIPT SCRIPT BLOCKS ]###############################################
67145
68146 script-block-node :
@@ -190,3 +268,9 @@ contexts:
190268
191269 embedded-bash-folded :
192270 - meta_include_prototype : false
271+
272+ embedded-pwsh :
273+ - meta_include_prototype : false
274+
275+ embedded-pwsh-folded :
276+ - meta_include_prototype : false
0 commit comments