@@ -24,12 +24,9 @@ contexts:
2424 - include : statements
2525
2626 statements :
27+ - include : classes
2728 - include : expressions
2829 - include : functions
29- - match : \b((?i:class))\s+([\w-]+)\b
30- captures :
31- 1 : storage.type.class.powershell
32- 2 : meta.class.powershell entity.name.class.powershell
3330 # Exceptions
3431 - match : \b(?i:throw){{kebab_break}}
3532 scope : keyword.control.exception.raise.powershell
@@ -101,7 +98,6 @@ contexts:
10198 - include : script-blocks
10299 - include : escape-sequences
103100 - include : numbers
104- - include : class-methods
105101 - include : groups
106102 - include : arrays
107103 - include : subexpressions
@@ -120,9 +116,6 @@ contexts:
120116 push :
121117 - meta_content_scope : string.unquoted.powershell
122118 - include : pop-before-eol
123- - match : \b(?i:hidden|static)\b
124- # This should only be relevant inside a class but will require a rework of how classes are matched. This is a temp fix.
125- scope : storage.modifier.powershell
126119
127120 - include : operators
128121
@@ -349,6 +342,12 @@ contexts:
349342 - match : \}
350343 scope : punctuation.section.braces.end.powershell
351344 pop : true
345+
346+ # TODO: Fix classes, so this doesn't nest here.
347+ - include : class-methods
348+ - match : \b(?i:hidden|static)\b
349+ scope : storage.modifier.powershell
350+
352351 - include : statements
353352
354353 types :
@@ -366,6 +365,30 @@ contexts:
366365 scope : storage.type.powershell
367366 - include : types
368367
368+ # ##[ CLASSES ]#################################################################
369+
370+ classes :
371+ - match : \b((?i:class))\s+([\w-]+)\b
372+ captures :
373+ 1 : storage.type.class.powershell
374+ 2 : meta.class.powershell entity.name.class.powershell
375+
376+ class-methods :
377+ - match : ^(?:\s*)(?i)(hidden|static)?\s*(\[)((?!\d+|\.)[\p{L}\p{N}.]+)(\])\s*((?:\p{L}|\d|_|-|\.)+)\s*(?=\()
378+ scope : meta.function.powershell
379+ captures :
380+ 1 : storage.modifier.powershell
381+ 2 : punctuation.section.brackets.begin.powershell
382+ 3 : storage.type.powershell
383+ 4 : punctuation.section.brackets.end.powershell
384+ 5 : entity.name.function.powershell
385+ push :
386+ - match : (?=\()
387+ pop : true
388+ - include : comment-line
389+
390+ # ##[ VARIABLES ]###############################################################
391+
369392 variables :
370393 - match : |-
371394 (?xi:
@@ -526,20 +549,6 @@ contexts:
526549 4 : variable.other.readwrite.powershell
527550 5 : punctuation.section.braces.end
528551
529- class-methods :
530- - match : ^(?:\s*)(?i)(hidden|static)?\s*(\[)((?!\d+|\.)[\p{L}\p{N}.]+)(\])\s*((?:\p{L}|\d|_|-|\.)+)\s*(?=\()
531- scope : meta.function.powershell
532- captures :
533- 1 : storage.modifier.powershell
534- 2 : punctuation.section.brackets.begin.powershell
535- 3 : storage.type.powershell
536- 4 : punctuation.section.brackets.end.powershell
537- 5 : entity.name.function.powershell
538- push :
539- - match : (?=\()
540- pop : true
541- - include : comment-line
542-
543552# ##[ GROUPS ]##################################################################
544553
545554 groups :
0 commit comments