@@ -211,7 +211,6 @@ contexts:
211211# ##[ COMMANDS ]################################################################
212212
213213 commands :
214- - include : commands-add-type
215214 - include : commands-verb-noun
216215 - include : commands-reserved
217216 - include : script-invocation
@@ -236,32 +235,6 @@ contexts:
236235 - match : \b[\w.\\/-]+\.(?i:exe|com|cmd|bat|ps1)\b
237236 scope : variable.function.powershell
238237
239- commands-add-type :
240- - match : \b(?i:Add-Type)\b
241- scope : support.function.powershell
242- push : inside-add-type
243-
244- inside-add-type :
245- - include : pop-eol
246-
247- - match : ' @"'
248- scope : meta.string.interpolated.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell
249- embed : scope:source.cs
250- embed_scope : meta.string.interpolated.powershell string.quoted.double.powershell source.cs.embedded
251- escape : ("@)
252- escape_captures :
253- 1 : meta.string.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell
254-
255- - match : " @'"
256- scope : meta.string.powershell string.quoted.single.powershell punctuation.definition.string.begin.powershell
257- embed : scope:source.cs
258- embed_scope : meta.string.powershell string.quoted.single.powershell source.cs.embedded
259- escape : ('@)
260- escape_captures :
261- 1 : meta.string.powershell string.quoted.single.powershell punctuation.definition.string.end.powershell
262-
263- - include : expressions
264-
265238 parameters :
266239 # Flags/Options/Parameters
267240 - match : \B(--?|[/+])\p{L}(?:[\w-]*\w)?
@@ -754,7 +727,20 @@ contexts:
754727 single-quoted-heredoc-strings :
755728 - match : \@'(?=$)
756729 scope : punctuation.definition.string.begin.powershell
757- push : inside-single-quoted-heredoc-string
730+ push :
731+ - inside-single-quoted-heredoc-string
732+ - inside-single-quoted-heredoc-string.syntax
733+
734+ inside-single-quoted-heredoc-string.syntax :
735+ - meta_include_prototype : false
736+ - match : (?={{csharp_indicator}})
737+ set : scope:source.cs
738+ with_prototype :
739+ - match : (?=^'@)
740+ pop : 1
741+ - match : " ''"
742+ scope : constant.character.escape.powershell
743+ - include : else-pop
758744
759745 inside-single-quoted-heredoc-string :
760746 - meta_include_prototype : false
@@ -768,7 +754,9 @@ contexts:
768754 double-quoted-heredoc-strings :
769755 - match : \@"(?=$)
770756 scope : punctuation.definition.string.begin.powershell
771- push : inside-double-quoted-heredoc-string
757+ push :
758+ - inside-double-quoted-heredoc-string
759+ - inside-double-quoted-heredoc-string.syntax
772760
773761 inside-double-quoted-heredoc-string :
774762 - meta_include_prototype : false
@@ -779,6 +767,16 @@ contexts:
779767 - include : escape-sequences
780768 - include : string-interpolations
781769
770+ inside-double-quoted-heredoc-string.syntax :
771+ - meta_include_prototype : false
772+ - match : (?={{csharp_indicator}})
773+ set : scope:source.cs
774+ with_prototype :
775+ - match : (?=^"@)
776+ pop : 1
777+ - include : escape-sequences
778+ - include : else-pop
779+
782780 string-interpolations :
783781 - match : \$\(
784782 scope : punctuation.section.interpolation.begin.powershell
@@ -1062,3 +1060,11 @@ variables:
10621060 Alias | Cmdlet | HelpFile | Function | Provider | General | FAQ
10631061 | Glossary | ScriptCommand | ExternalScript | Filter | All
10641062 )
1063+
1064+ # Strings
1065+ csharp_indicator : |-
1066+ (?x: \s* (?:
1067+ using\s+System[.;]
1068+ | public\s+class\s+
1069+ | \[DllImport\b
1070+ ))
0 commit comments