@@ -75,73 +75,77 @@ contexts:
75
75
- include : main
76
76
- match : \b[\w.-]+\.(?i:exe|com|cmd|bat)\b
77
77
scope : variable.function.powershell
78
+ # Consume a string with a trailing dot
79
+ # to prevent members with particular names from being recognized as keywords.
80
+ - match : \b[\w-]+(?=\.)
81
+ push : members
78
82
# Exceptions
79
- - match : (?<![.]) \b(?i:throw){{kebab_break}}
83
+ - match : \b(?i:throw){{kebab_break}}
80
84
scope : keyword.control.exception.raise.powershell
81
- - match : (?<![.]) \b(?i:try){{kebab_break}}
85
+ - match : \b(?i:try){{kebab_break}}
82
86
scope : keyword.control.exception.try.powershell
83
- - match : (?<![.]) \b(?i:catch|trap){{kebab_break}}
87
+ - match : \b(?i:catch|trap){{kebab_break}}
84
88
scope : keyword.control.exception.catch.powershell
85
- - match : (?<![.]) \b(?i:finally){{kebab_break}}
89
+ - match : \b(?i:finally){{kebab_break}}
86
90
scope : keyword.control.exception.finally.powershell
87
91
# Conditionals
88
- - match : (?<![.]) \b(?i:if){{kebab_break}}
92
+ - match : \b(?i:if){{kebab_break}}
89
93
scope : keyword.control.conditional.if.powershell
90
- - match : (?<![.]) \b(?i:elseif){{kebab_break}}
94
+ - match : \b(?i:elseif){{kebab_break}}
91
95
scope : keyword.control.conditional.elseif.powershell
92
- - match : (?<![.]) \b(?i:else){{kebab_break}}
96
+ - match : \b(?i:else){{kebab_break}}
93
97
scope : keyword.control.conditional.else.powershell
94
- - match : (?<![.]) \b(?i:switch){{kebab_break}}
98
+ - match : \b(?i:switch){{kebab_break}}
95
99
scope : keyword.control.conditional.switch.powershell
96
100
- match : \?
97
101
scope : keyword.control.conditional.select.powershell
98
102
- match : \b(?i:where(?!-object)){{kebab_break}}
99
103
scope : keyword.control.conditional.select.powershell
100
104
# Begin/End
101
- - match : (?<![.]) \b(?i:begin){{kebab_break}}
105
+ - match : \b(?i:begin){{kebab_break}}
102
106
scope : keyword.context.block.begin.powershell
103
- - match : (?<![.]) \b(?i:process){{kebab_break}}
107
+ - match : \b(?i:process){{kebab_break}}
104
108
scope : keyword.context.block.process.powershell
105
- - match : (?<![.]) \b(?i:end){{kebab_break}}
109
+ - match : \b(?i:end){{kebab_break}}
106
110
scope : keyword.context.block.end.powershell
107
- - match : (?<![.]) \b(?i:clean){{kebab_break}}
111
+ - match : \b(?i:clean){{kebab_break}}
108
112
scope : keyword.context.block.clean.powershell
109
113
# Loops
110
114
- match : \b(?i:for|foreach(?!-object)){{kebab_break}}
111
115
scope : keyword.control.loop.for.powershell
112
- - match : (?<![.]) \b(?i:do){{kebab_break}}
116
+ - match : \b(?i:do){{kebab_break}}
113
117
scope : keyword.control.loop.do-while.powershell
114
- - match : (?<![.]) \b(?i:while){{kebab_break}}
118
+ - match : \b(?i:while){{kebab_break}}
115
119
scope : keyword.control.loop.while.powershell
116
- - match : (?<![.]) \b(?i:until){{kebab_break}}
120
+ - match : \b(?i:until){{kebab_break}}
117
121
scope : keyword.control.loop.repeat-until.powershell
118
122
# Flow
119
- - match : (?<![.]) \b(?i:break){{kebab_break}}
123
+ - match : \b(?i:break){{kebab_break}}
120
124
scope : keyword.control.flow.break.powershell
121
- - match : (?<![.]) \b(?i:continue){{kebab_break}}
125
+ - match : \b(?i:continue){{kebab_break}}
122
126
scope : keyword.control.flow.continue.powershell
123
- - match : (?<![.]) \b(?i:exit){{kebab_break}}
127
+ - match : \b(?i:exit){{kebab_break}}
124
128
scope : keyword.control.flow.exit.powershell
125
- - match : (?<![.]) \b(?i:return){{kebab_break}}
129
+ - match : \b(?i:return){{kebab_break}}
126
130
scope : keyword.control.flow.return.powershell
127
131
# Declaration
128
- - match : (?<![.]) \b(?i:var){{kebab_break}}
132
+ - match : \b(?i:var){{kebab_break}}
129
133
# scope: storage.type.variable.powershell
130
134
scope : keyword.declaration.variable.powershell
131
- - match : (?<![.]) \b(?i:(?:dynamic)?param){{kebab_break}}
135
+ - match : \b(?i:(?:dynamic)?param){{kebab_break}}
132
136
scope : keyword.declaration.parameter.powershell # This scope is not standard
133
137
# Uncategorized keywords
134
- - match : (?<![.]) \b(?i:data|default|define|from|in|inlinescript|parallel|sequence){{kebab_break}}
138
+ - match : \b(?i:data|default|define|from|in|inlinescript|parallel|sequence){{kebab_break}}
135
139
scope : keyword.control.powershell
136
140
- match : \B--%\B
137
141
scope : keyword.control.powershell
138
142
push :
139
143
- meta_content_scope : string.unquoted.powershell
140
144
- include : pop-before-newline
141
- - match : (?<![.]) \b(?i:hidden|static)\b
145
+ - match : \b(?i:hidden|static)\b
142
146
# This should only be relevant inside a class but will require a rework of how classes are matched. This is a temp fix.
143
147
scope : storage.modifier.powershell
144
- - match : (?<![.]) \b((?i:class))\s+([\w-]+)\b
148
+ - match : \b((?i:class))\s+([\w-]+)\b
145
149
captures :
146
150
1 : storage.type.class.powershell
147
151
2 : meta.class.powershell entity.name.class.powershell
0 commit comments