|
69 | 69 | <key>include</key> |
70 | 70 | <string>#stringSingleQuotedHeredoc</string> |
71 | 71 | </dict> |
| 72 | + <dict> |
| 73 | + <key>include</key> |
| 74 | + <string>#switch</string> |
| 75 | + </dict> |
72 | 76 | <dict> |
73 | 77 | <key>include</key> |
74 | 78 | <string>#scriptBlock</string> |
|
115 | 119 | </dict> |
116 | 120 | <dict> |
117 | 121 | <key>include</key> |
118 | | - <string>#commands-OLD</string> |
119 | | - </dict> |
120 | | - <dict> |
121 | | - <key>include</key> |
122 | | - <string>#commands-NEW</string> |
| 122 | + <string>#commands</string> |
123 | 123 | </dict> |
124 | 124 | <dict> |
125 | 125 | <key>include</key> |
126 | 126 | <string>#executableFiles</string> |
127 | 127 | </dict> |
128 | | - <dict> |
129 | | - <key>include</key> |
130 | | - <string>#parameter-OLD</string> |
131 | | - </dict> |
132 | 128 | <dict> |
133 | 129 | <key>include</key> |
134 | 130 | <string>#illegalVariable</string> |
|
137 | 133 | <key>include</key> |
138 | 134 | <string>#variable</string> |
139 | 135 | </dict> |
140 | | - <dict> |
141 | | - <key>include</key> |
142 | | - <string>#demoScopeHighlighting</string> |
143 | | - </dict> |
144 | 136 | </array> |
145 | 137 | <key>repository</key> |
146 | 138 | <dict> |
|
225 | 217 | <key>comment</key> |
226 | 218 | <string>-Parameter value</string> |
227 | 219 | <key>match</key> |
228 | | - <string>(-\w+)(:)?</string> |
| 220 | + <string>\s(-\w+)(:)?</string> |
229 | 221 | <key>name</key> |
230 | 222 | <string>variable.parameter.powershell</string> |
231 | 223 | </dict> |
232 | 224 | </array> |
233 | 225 | </dict> |
234 | 226 | <key>commands</key> |
235 | | - <dict> |
236 | | - <key>patterns</key> |
237 | | - <array> |
238 | | - <dict> |
239 | | - <key>comment</key> |
240 | | - <string>Generic function match based on Verb-Noun pair using list of approved verbs.</string> |
241 | | - <key>match</key> |
242 | | - <string>(?<!\\)\b(?i:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Mount|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Write)-(?i:\w+)\b(?!\.|\\)</string> |
243 | | - <key>name</key> |
244 | | - <string>support.function.powershell</string> |
245 | | - </dict> |
246 | | - <dict> |
247 | | - <key>comment</key> |
248 | | - <string>Built-in commands that don't adhere to the approved verbs standard.</string> |
249 | | - <key>match</key> |
250 | | - <string>(?<!\\)\b(?i:foreach-object|tee-object|where-object|sort-object)\b(?!\.|\\)</string> |
251 | | - <key>name</key> |
252 | | - <string>support.function.powershell</string> |
253 | | - </dict> |
254 | | - <dict> |
255 | | - <key>comment</key> |
256 | | - <string>Built-in aliases</string> |
257 | | - <key>match</key> |
258 | | - <string>(?<!\\|\[)\b(?i:ac|asnp|cat|cd|cfs|chdir|clc|clear|clhy|cli|clp|cls|clv|cnsn|compare|copy|cp|cpi|cpp|curl|cvpa|dbp|del|diff|dir|dnsn|ebp|echo|epal|epcsv|epsn|erase|etsn|exsn|fc|fhx|fl|ft|fw|gal|gbp|gc|gcb|gci|gcm|gcs|gdr|ghy|gi|gjb|gl|gm|gmo|gp|gps|gpv|group|gsn|gsnp|gsv|gu|gv|gwmi|h|history|icm|iex|ihy|ii|ipal|ipcsv|ipmo|ipsn|irm|ise|iwmi|iwr|kill|lp|ls|man|md|measure|mi|mount|move|mp|mv|nal|ndr|ni|nmo|npssc|nsn|nv|ogv|oh|popd|ps|pushd|r|rbp|rcjb|rcsn|rd|rdr|ren|ri|rjb|rm|rmdir|rmo|rni|rnp|rp|rsn|rsnp|rujb|rv|rvpa|rwmi|sajb|sal|saps|sasv|sbp|sc|scb|select|set|shcm|si|sl|sleep|sls|sort|sp|spjb|spps|spsv|start|sujb|sv|swmi|tee|trcm|type|wget|wjb|write)\b(?!\.|\\|\])</string> |
259 | | - <key>name</key> |
260 | | - <string>support.other.alias.powershell</string> |
261 | | - </dict> |
262 | | - </array> |
263 | | - </dict> |
264 | | - <key>commands-NEW</key> |
265 | 227 | <dict> |
266 | 228 | <key>patterns</key> |
267 | 229 | <array> |
|
736 | 698 | <key>name</key> |
737 | 699 | <string>keyword.control.powershell</string> |
738 | 700 | </dict> |
739 | | - <key>demoScopeHighlighting</key> |
| 701 | + <key>defaultKeyword</key> |
740 | 702 | <dict> |
741 | | - <key>patterns</key> |
742 | | - <array> |
743 | | - <dict> |
744 | | - <key>match</key> |
745 | | - <string>\b(demo_scope_constantLanguage)\b</string> |
746 | | - <key>name</key> |
747 | | - <string>constant.language</string> |
748 | | - </dict> |
749 | | - <dict> |
750 | | - <key>match</key> |
751 | | - <string>\b(demo_scope_constantNumeric)\b</string> |
752 | | - <key>name</key> |
753 | | - <string>constant.numeric</string> |
754 | | - </dict> |
755 | | - <dict> |
756 | | - <key>match</key> |
757 | | - <string>\b(demo_scope_constantOther)\b</string> |
758 | | - <key>name</key> |
759 | | - <string>constant.other</string> |
760 | | - </dict> |
761 | | - <dict> |
762 | | - <key>match</key> |
763 | | - <string>\b(demo_scope_constantCharacterEscape)\b</string> |
764 | | - <key>name</key> |
765 | | - <string>constant.character.escape</string> |
766 | | - </dict> |
767 | | - <dict> |
768 | | - <key>match</key> |
769 | | - <string>\b(demo_scope_entityOtherAttributeName)\b</string> |
770 | | - <key>name</key> |
771 | | - <string>entity.other.attribute-name</string> |
772 | | - </dict> |
773 | | - <dict> |
774 | | - <key>match</key> |
775 | | - <string>\b(demo_scope_invalid)\b</string> |
776 | | - <key>name</key> |
777 | | - <string>invalid</string> |
778 | | - </dict> |
779 | | - <dict> |
780 | | - <key>match</key> |
781 | | - <string>\b(demo_scope_comment)\b</string> |
782 | | - <key>name</key> |
783 | | - <string>comment</string> |
784 | | - </dict> |
785 | | - <dict> |
786 | | - <key>match</key> |
787 | | - <string>\b(demo_scope_metaSelector)\b</string> |
788 | | - <key>name</key> |
789 | | - <string>meta.selector</string> |
790 | | - </dict> |
791 | | - <dict> |
792 | | - <key>match</key> |
793 | | - <string>\b(demo_scope_storageType)\b</string> |
794 | | - <key>name</key> |
795 | | - <string>storage.type</string> |
796 | | - </dict> |
797 | | - <dict> |
798 | | - <key>match</key> |
799 | | - <string>\b(demo_scope_string)\b</string> |
800 | | - <key>name</key> |
801 | | - <string>string</string> |
802 | | - </dict> |
803 | | - <dict> |
804 | | - <key>match</key> |
805 | | - <string>\b(demo_scope_keywordControl)\b</string> |
806 | | - <key>name</key> |
807 | | - <string>keyword.control</string> |
808 | | - </dict> |
809 | | - <dict> |
810 | | - <key>match</key> |
811 | | - <string>\b(demo_scope_keywordOperator)\b</string> |
812 | | - <key>name</key> |
813 | | - <string>keyword.operator</string> |
814 | | - </dict> |
815 | | - <dict> |
816 | | - <key>match</key> |
817 | | - <string>\b(demo_scope_keywordOtherUnit)\b</string> |
818 | | - <key>name</key> |
819 | | - <string>keyword.other.unit</string> |
820 | | - </dict> |
821 | | - <dict> |
822 | | - <key>match</key> |
823 | | - <string>\b(demo_scope_supportType)\b</string> |
824 | | - <key>name</key> |
825 | | - <string>support.type</string> |
826 | | - </dict> |
827 | | - <dict> |
828 | | - <key>match</key> |
829 | | - <string>\b(demo_scope_supportConstant)\b</string> |
830 | | - <key>name</key> |
831 | | - <string>support.constant</string> |
832 | | - </dict> |
833 | | - <dict> |
834 | | - <key>match</key> |
835 | | - <string>\b(demo_scope_supportVariable)\b</string> |
836 | | - <key>name</key> |
837 | | - <string>support.variable</string> |
838 | | - </dict> |
839 | | - <dict> |
840 | | - <key>match</key> |
841 | | - <string>\b(demo_scope_entityNameClass)\b</string> |
842 | | - <key>name</key> |
843 | | - <string>entity.name.class</string> |
844 | | - </dict> |
845 | | - <dict> |
846 | | - <key>match</key> |
847 | | - <string>\b(demo_scope_entityNameType)\b</string> |
848 | | - <key>name</key> |
849 | | - <string>entity.name.type</string> |
850 | | - </dict> |
851 | | - <dict> |
852 | | - <key>match</key> |
853 | | - <string>\b(demo_scope_entityNameFunction)\b</string> |
854 | | - <key>name</key> |
855 | | - <string>entity.name.function</string> |
856 | | - </dict> |
857 | | - <dict> |
858 | | - <key>match</key> |
859 | | - <string>\b(demo_scope_metaParameterTypeVariable)\b</string> |
860 | | - <key>name</key> |
861 | | - <string>meta.parameter.type.variable</string> |
862 | | - </dict> |
863 | | - <dict> |
864 | | - <key>match</key> |
865 | | - <string>\b(demo_scope_metaTypeAnnotation)\b</string> |
866 | | - <key>name</key> |
867 | | - <string>meta.type.annotation</string> |
868 | | - </dict> |
869 | | - <dict> |
870 | | - <key>match</key> |
871 | | - <string>\b(demo_scope_variableParameter)\b</string> |
872 | | - <key>name</key> |
873 | | - <string>variable.parameter</string> |
874 | | - </dict> |
875 | | - <dict> |
876 | | - <key>match</key> |
877 | | - <string>\b(demo_scope_variableLanguage)\b</string> |
878 | | - <key>name</key> |
879 | | - <string>variable.language</string> |
880 | | - </dict> |
| 703 | + <key>captures</key> |
| 704 | + <dict> |
| 705 | + <key>0</key> |
881 | 706 | <dict> |
882 | | - <key>match</key> |
883 | | - <string>\b(demo_scope_variableOther)\b</string> |
884 | 707 | <key>name</key> |
885 | | - <string>variable.other</string> |
| 708 | + <string>keyword.other.powershell</string> |
886 | 709 | </dict> |
887 | | - </array> |
| 710 | + </dict> |
| 711 | + <key>comment</key> |
| 712 | + <string>Default is a reserved word when used in Switch statements. This is kind of a work-around - it will highlight only inside scriptblocks.</string> |
| 713 | + <key>match</key> |
| 714 | + <string>(?i:(default))\s*(?=\{)</string> |
888 | 715 | </dict> |
889 | 716 | <key>executableFiles</key> |
890 | 717 | <dict> |
|
1138 | 965 | </dict> |
1139 | 966 | </array> |
1140 | 967 | </dict> |
1141 | | - <key>parameter</key> |
1142 | | - <dict> |
1143 | | - <key>match</key> |
1144 | | - <string>((?<=\s)-(\w+))</string> |
1145 | | - <key>name</key> |
1146 | | - <string>variable.parameter.powershell</string> |
1147 | | - </dict> |
1148 | 968 | <key>redirection</key> |
1149 | 969 | <dict> |
1150 | 970 | <key>patterns</key> |
|
1174 | 994 | <key>name</key> |
1175 | 995 | <string>keyword.other.powershell</string> |
1176 | 996 | </dict> |
1177 | | - <key>scriptblock</key> |
| 997 | + <key>scriptBlock</key> |
1178 | 998 | <dict> |
1179 | 999 | <key>begin</key> |
1180 | | - <string>\{</string> |
| 1000 | + <string>(\{)</string> |
1181 | 1001 | <key>end</key> |
1182 | | - <string>\}</string> |
| 1002 | + <string>(\})</string> |
1183 | 1003 | <key>name</key> |
1184 | 1004 | <string>meta.scriptblock.powershell</string> |
1185 | 1005 | <key>patterns</key> |
|
1188 | 1008 | <key>include</key> |
1189 | 1009 | <string>$self</string> |
1190 | 1010 | </dict> |
| 1011 | + <dict> |
| 1012 | + <key>include</key> |
| 1013 | + <string>#defaultKeyword</string> |
| 1014 | + </dict> |
1191 | 1015 | </array> |
1192 | 1016 | </dict> |
1193 | 1017 | <key>stringDoubleQuoted</key> |
|
1216 | 1040 | <key>include</key> |
1217 | 1041 | <string>#subExpression</string> |
1218 | 1042 | </dict> |
1219 | | - <dict> |
1220 | | - <key>include</key> |
1221 | | - <string>#scriptBlock</string> |
1222 | | - </dict> |
1223 | 1043 | </array> |
1224 | 1044 | </dict> |
1225 | 1045 | <key>stringDoubleQuotedHeredoc</key> |
|
1337 | 1157 | </dict> |
1338 | 1158 | </array> |
1339 | 1159 | </dict> |
| 1160 | + <key>switch</key> |
| 1161 | + <dict> |
| 1162 | + <key>patterns</key> |
| 1163 | + <array> |
| 1164 | + <dict> |
| 1165 | + <key>captures</key> |
| 1166 | + <dict> |
| 1167 | + <key>1</key> |
| 1168 | + <dict> |
| 1169 | + <key>name</key> |
| 1170 | + <string>keyword.control.powershell</string> |
| 1171 | + </dict> |
| 1172 | + <key>2</key> |
| 1173 | + <dict> |
| 1174 | + <key>name</key> |
| 1175 | + <string>variable.parameter.powershell</string> |
| 1176 | + </dict> |
| 1177 | + <key>4</key> |
| 1178 | + <dict> |
| 1179 | + <key>name</key> |
| 1180 | + <string>variable.parameter.powershell</string> |
| 1181 | + </dict> |
| 1182 | + <key>5</key> |
| 1183 | + <dict> |
| 1184 | + <key>name</key> |
| 1185 | + <string>variable.parameter.powershell</string> |
| 1186 | + </dict> |
| 1187 | + </dict> |
| 1188 | + <key>comment</key> |
| 1189 | + <string>switch [-regex|-wildcard|-exact][-casesensitive] -file filename</string> |
| 1190 | + <key>match</key> |
| 1191 | + <string>\b(?i:(switch))\b\s+(?i:(-regex|-wildcard|-exact){0,1})\s*(?i:(-casesensitive){0,1})\s*(?i:(-file))\s+</string> |
| 1192 | + </dict> |
| 1193 | + <dict> |
| 1194 | + <key>captures</key> |
| 1195 | + <dict> |
| 1196 | + <key>1</key> |
| 1197 | + <dict> |
| 1198 | + <key>name</key> |
| 1199 | + <string>keyword.control.powershell</string> |
| 1200 | + </dict> |
| 1201 | + <key>2</key> |
| 1202 | + <dict> |
| 1203 | + <key>name</key> |
| 1204 | + <string>variable.parameter.powershell</string> |
| 1205 | + </dict> |
| 1206 | + <key>3</key> |
| 1207 | + <dict> |
| 1208 | + <key>name</key> |
| 1209 | + <string>variable.parameter.powershell</string> |
| 1210 | + </dict> |
| 1211 | + </dict> |
| 1212 | + <key>comment</key> |
| 1213 | + <string>switch [-regex|-wildcard|-exact][-casesensitive] (<value>)</string> |
| 1214 | + <key>match</key> |
| 1215 | + <string>\b(?i:(switch))\b\s+(?i:(-regex|-wildcard|-exact){0,1})\s*(?i:(-casesensitive){0,1})\s*</string> |
| 1216 | + </dict> |
| 1217 | + </array> |
| 1218 | + </dict> |
1340 | 1219 | <key>type</key> |
1341 | 1220 | <dict> |
1342 | 1221 | <key>begin</key> |
|
0 commit comments