View raw

1 { 2 "information_for_contributors": [ 3 "This file has been converted from https://github.com/PowerShell/EditorSyntax/blob/master/PowerShellSyntax.tmLanguage", 4 "If you want to provide a fix or improvement, please create a pull request against the original repository.", 5 "Once accepted there, we are happy to receive an update request." 6 ], 7 "version": "https://github.com/PowerShell/EditorSyntax/commit/742f0b5d4b60f5930c0b47fcc1f646860521296e", 8 "name": "PowerShell", 9 "scopeName": "source.powershell", 10 "patterns": [ 11 { 12 "begin": "<#", 13 "beginCaptures": { 14 "0": { 15 "name": "punctuation.definition.comment.block.begin.powershell" 16 } 17 }, 18 "end": "#>", 19 "endCaptures": { 20 "0": { 21 "name": "punctuation.definition.comment.block.end.powershell" 22 } 23 }, 24 "name": "comment.block.powershell", 25 "patterns": [ 26 { 27 "include": "#commentEmbeddedDocs" 28 } 29 ] 30 }, 31 { 32 "match": "[2-6]>&1|>>|>|<<|<|>|>\\||[1-6]>|[1-6]>>", 33 "name": "keyword.operator.redirection.powershell" 34 }, 35 { 36 "include": "#commands" 37 }, 38 { 39 "include": "#commentLine" 40 }, 41 { 42 "include": "#variable" 43 }, 44 { 45 "include": "#subexpression" 46 }, 47 { 48 "include": "#function" 49 }, 50 { 51 "include": "#attribute" 52 }, 53 { 54 "include": "#UsingDirective" 55 }, 56 { 57 "include": "#type" 58 }, 59 { 60 "include": "#hashtable" 61 }, 62 { 63 "include": "#doubleQuotedString" 64 }, 65 { 66 "include": "#scriptblock" 67 }, 68 { 69 "comment": "Needed to parse stuff correctly in 'argument mode'. (See about_parsing.)", 70 "include": "#doubleQuotedStringEscapes" 71 }, 72 { 73 "begin": "['\\x{2018}-\\x{201B}]", 74 "beginCaptures": { 75 "0": { 76 "name": "punctuation.definition.string.begin.powershell" 77 } 78 }, 79 "end": "['\\x{2018}-\\x{201B}]", 80 "applyEndPatternLast": true, 81 "endCaptures": { 82 "0": { 83 "name": "punctuation.definition.string.end.powershell" 84 } 85 }, 86 "name": "string.quoted.single.powershell", 87 "patterns": [ 88 { 89 "match": "['\\x{2018}-\\x{201B}]{2}", 90 "name": "constant.character.escape.powershell" 91 } 92 ] 93 }, 94 { 95 "begin": "(@[\"\\x{201C}-\\x{201E}])\\s*$", 96 "beginCaptures": { 97 "1": { 98 "name": "punctuation.definition.string.begin.powershell" 99 } 100 }, 101 "end": "^[\"\\x{201C}-\\x{201E}]@", 102 "endCaptures": { 103 "0": { 104 "name": "punctuation.definition.string.end.powershell" 105 } 106 }, 107 "name": "string.quoted.double.heredoc.powershell", 108 "patterns": [ 109 { 110 "include": "#variableNoProperty" 111 }, 112 { 113 "include": "#doubleQuotedStringEscapes" 114 }, 115 { 116 "include": "#interpolation" 117 } 118 ] 119 }, 120 { 121 "begin": "(@['\\x{2018}-\\x{201B}])\\s*$", 122 "beginCaptures": { 123 "1": { 124 "name": "punctuation.definition.string.begin.powershell" 125 } 126 }, 127 "end": "^['\\x{2018}-\\x{201B}]@", 128 "endCaptures": { 129 "0": { 130 "name": "punctuation.definition.string.end.powershell" 131 } 132 }, 133 "name": "string.quoted.single.heredoc.powershell" 134 }, 135 { 136 "include": "#numericConstant" 137 }, 138 { 139 "begin": "(@)(\\()", 140 "beginCaptures": { 141 "1": { 142 "name": "keyword.other.array.begin.powershell" 143 }, 144 "2": { 145 "name": "punctuation.section.group.begin.powershell" 146 } 147 }, 148 "end": "\\)", 149 "endCaptures": { 150 "0": { 151 "name": "punctuation.section.group.end.powershell" 152 } 153 }, 154 "name": "meta.group.array-expression.powershell", 155 "patterns": [ 156 { 157 "include": "$self" 158 } 159 ] 160 }, 161 { 162 "begin": "((\\$))(\\()", 163 "beginCaptures": { 164 "1": { 165 "name": "keyword.other.substatement.powershell" 166 }, 167 "2": { 168 "name": "punctuation.definition.subexpression.powershell" 169 }, 170 "3": { 171 "name": "punctuation.section.group.begin.powershell" 172 } 173 }, 174 "comment": "TODO: move to repo; make recursive.", 175 "end": "\\)", 176 "endCaptures": { 177 "0": { 178 "name": "punctuation.section.group.end.powershell" 179 } 180 }, 181 "name": "meta.group.complex.subexpression.powershell", 182 "patterns": [ 183 { 184 "include": "$self" 185 } 186 ] 187 }, 188 { 189 "match": "(\\b(([A-Za-z0-9\\-_\\.]+)\\.(?i:exe|com|cmd|bat))\\b)", 190 "name": "support.function.powershell" 191 }, 192 { 193 "match": "(?<!\\w|-|\\.)((?i:begin|break|catch|clean|continue|data|default|define|do|dynamicparam|else|elseif|end|exit|finally|for|from|if|in|inlinescript|parallel|param|process|return|sequence|switch|throw|trap|try|until|var|while)|%|\\?)(?!\\w)", 194 "name": "keyword.control.powershell" 195 }, 196 { 197 "match": "(?<!\\w|-|[^\\)]\\.)((?i:(foreach|where)(?!-object))|%|\\?)(?!\\w)", 198 "name": "keyword.control.powershell" 199 }, 200 { 201 "begin": "(?<!\\w)(--%)(?!\\w)", 202 "beginCaptures": { 203 "1": { 204 "name": "keyword.control.powershell" 205 } 206 }, 207 "end": "$", 208 "patterns": [ 209 { 210 "match": ".+", 211 "name": "string.unquoted.powershell" 212 } 213 ], 214 "comment": "This should be moved to the repository at some point." 215 }, 216 { 217 "comment": "This should only be relevant inside a class but will require a rework of how classes are matched. This is a temp fix.", 218 "match": "(?<!\\w)((?i:hidden|static))(?!\\w)", 219 "name": "storage.modifier.powershell" 220 }, 221 { 222 "captures": { 223 "1": { 224 "name": "storage.type.powershell" 225 }, 226 "2": { 227 "name": "entity.name.function" 228 } 229 }, 230 "comment": "capture should be entity.name.type, but it doesn't provide a good color in the default schema.", 231 "match": "(?<!\\w|-)((?i:class)|%|\\?)(?:\\s)+((?:\\p{L}|\\d|_|-|)+)\\b" 232 }, 233 { 234 "match": "(?<!\\w)-(?i:is(?:not)?|as)\\b", 235 "name": "keyword.operator.comparison.powershell" 236 }, 237 { 238 "match": "(?<!\\w)-(?i:[ic]?(?:eq|ne|[gl][te]|(?:not)?(?:like|match|contains|in)|replace))(?!\\p{L})", 239 "name": "keyword.operator.comparison.powershell" 240 }, 241 { 242 "match": "(?<!\\w)-(?i:join|split)(?!\\p{L})|!", 243 "name": "keyword.operator.unary.powershell" 244 }, 245 { 246 "match": "(?<!\\w)-(?i:and|or|not|xor)(?!\\p{L})|!", 247 "name": "keyword.operator.logical.powershell" 248 }, 249 { 250 "match": "(?<!\\w)-(?i:band|bor|bnot|bxor|shl|shr)(?!\\p{L})", 251 "name": "keyword.operator.bitwise.powershell" 252 }, 253 { 254 "match": "(?<!\\w)-(?i:f)(?!\\p{L})", 255 "name": "keyword.operator.string-format.powershell" 256 }, 257 { 258 "match": "[+%*/-]?=|[+/*%-]", 259 "name": "keyword.operator.assignment.powershell" 260 }, 261 { 262 "match": "\\|{2}|&{2}|;", 263 "name": "punctuation.terminator.statement.powershell" 264 }, 265 { 266 "match": "&|(?<!\\w)\\.(?= )|`|,|\\|", 267 "name": "keyword.operator.other.powershell" 268 }, 269 { 270 "comment": "This is very imprecise, is there a syntax for 'must come after...' ", 271 "match": "(?<!\\s|^)\\.\\.(?=\\-?\\d|\\(|\\$)", 272 "name": "keyword.operator.range.powershell" 273 } 274 ], 275 "repository": { 276 "commentLine": { 277 "begin": "(?<![`\\\\-])(#)#*", 278 "captures": { 279 "1": { 280 "name": "punctuation.definition.comment.powershell" 281 } 282 }, 283 "end": "$\\n?", 284 "name": "comment.line.powershell", 285 "patterns": [ 286 { 287 "include": "#commentEmbeddedDocs" 288 }, 289 { 290 "include": "#RequiresDirective" 291 } 292 ] 293 }, 294 "attribute": { 295 "begin": "(\\[)\\s*\\b(?i)(cmdletbinding|alias|outputtype|parameter|validatenotnull|validatenotnullorempty|validatecount|validateset|allownull|allowemptycollection|allowemptystring|validatescript|validaterange|validatepattern|validatelength|supportswildcards)\\b", 296 "beginCaptures": { 297 "1": { 298 "name": "punctuation.section.bracket.begin.powershell" 299 }, 300 "2": { 301 "name": "support.function.attribute.powershell" 302 } 303 }, 304 "end": "(\\])", 305 "endCaptures": { 306 "1": { 307 "name": "punctuation.section.bracket.end.powershell" 308 } 309 }, 310 "name": "meta.attribute.powershell", 311 "patterns": [ 312 { 313 "begin": "\\(", 314 "beginCaptures": { 315 "0": { 316 "name": "punctuation.section.group.begin.powershell" 317 } 318 }, 319 "end": "\\)", 320 "endCaptures": { 321 "0": { 322 "name": "punctuation.section.group.end.powershell" 323 } 324 }, 325 "patterns": [ 326 { 327 "include": "$self" 328 }, 329 { 330 "match": "(?i)\\b(mandatory|valuefrompipeline|valuefrompipelinebypropertyname|valuefromremainingarguments|position|parametersetname|defaultparametersetname|supportsshouldprocess|supportspaging|positionalbinding|helpuri|confirmimpact|helpmessage)\\b(?:\\s+)?(=)?", 331 "captures": { 332 "1": { 333 "name": "variable.parameter.attribute.powershell" 334 }, 335 "2": { 336 "name": "keyword.operator.assignment.powershell" 337 } 338 } 339 } 340 ] 341 } 342 ] 343 }, 344 "commands": { 345 "patterns": [ 346 { 347 "comment": "Verb-Noun pattern:", 348 "match": "(?:(\\p{L}|\\d|_|-|\\\\|\\:)*\\\\)?\\b(?i:Add|Approve|Assert|Backup|Block|Build|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Deploy|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:exe|cmd|bat|ps1))?\\b", 349 "name": "support.function.powershell" 350 }, 351 { 352 "comment": "Builtin cmdlets with reserved verbs", 353 "match": "(?<!\\w)(?i:foreach-object)(?!\\w)", 354 "name": "support.function.powershell" 355 }, 356 { 357 "comment": "Builtin cmdlets with reserved verbs", 358 "match": "(?<!\\w)(?i:where-object)(?!\\w)", 359 "name": "support.function.powershell" 360 }, 361 { 362 "comment": "Builtin cmdlets with reserved verbs", 363 "match": "(?<!\\w)(?i:sort-object)(?!\\w)", 364 "name": "support.function.powershell" 365 }, 366 { 367 "comment": "Builtin cmdlets with reserved verbs", 368 "match": "(?<!\\w)(?i:tee-object)(?!\\w)", 369 "name": "support.function.powershell" 370 } 371 ] 372 }, 373 "commentEmbeddedDocs": { 374 "patterns": [ 375 { 376 "captures": { 377 "1": { 378 "name": "constant.string.documentation.powershell" 379 }, 380 "2": { 381 "name": "keyword.operator.documentation.powershell" 382 } 383 }, 384 "comment": "these embedded doc keywords do not support arguments, must be the only thing on the line", 385 "match": "(?:^|\\G)(?i:\\s*(\\.)(COMPONENT|DESCRIPTION|EXAMPLE|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|ROLE|SYNOPSIS))\\s*$", 386 "name": "comment.documentation.embedded.powershell" 387 }, 388 { 389 "captures": { 390 "1": { 391 "name": "constant.string.documentation.powershell" 392 }, 393 "2": { 394 "name": "keyword.operator.documentation.powershell" 395 }, 396 "3": { 397 "name": "keyword.operator.documentation.powershell" 398 } 399 }, 400 "comment": "these embedded doc keywords require arguments though the type required may be inconsistent, they may not all be able to use the same argument match", 401 "match": "(?:^|\\G)(?i:\\s*(\\.)(EXTERNALHELP|FORWARDHELP(?:CATEGORY|TARGETNAME)|PARAMETER|REMOTEHELPRUNSPACE))\\s+(.+?)\\s*$", 402 "name": "comment.documentation.embedded.powershell" 403 } 404 ] 405 }, 406 "doubleQuotedStringEscapes": { 407 "patterns": [ 408 { 409 "match": "`[`0abefnrtv'\"\\x{2018}-\\x{201E}$]", 410 "name": "constant.character.escape.powershell" 411 }, 412 { 413 "include": "#unicodeEscape" 414 } 415 ] 416 }, 417 "unicodeEscape": { 418 "comment": "`u{xxxx} added in PowerShell 6.0", 419 "patterns": [ 420 { 421 "match": "`u\\{(?:(?:10)?([0-9a-fA-F]){1,4}|0?\\g<1>{1,5})}", 422 "name": "constant.character.escape.powershell" 423 }, 424 { 425 "match": "`u(?:\\{[0-9a-fA-F]{,6}.)?", 426 "name": "invalid.character.escape.powershell" 427 } 428 ] 429 }, 430 "function": { 431 "begin": "^(?:\\s*+)(?i)(function|filter|configuration|workflow)\\s+(?:(global|local|script|private):)?((?:\\p{L}|\\d|_|-|\\.)+)", 432 "beginCaptures": { 433 "0": { 434 "name": "meta.function.powershell" 435 }, 436 "1": { 437 "name": "storage.type.powershell" 438 }, 439 "2": { 440 "name": "storage.modifier.scope.powershell" 441 }, 442 "3": { 443 "name": "entity.name.function.powershell" 444 } 445 }, 446 "end": "(?=\\{|\\()", 447 "patterns": [ 448 { 449 "include": "#commentLine" 450 } 451 ] 452 }, 453 "subexpression": { 454 "begin": "\\(", 455 "beginCaptures": { 456 "0": { 457 "name": "punctuation.section.group.begin.powershell" 458 } 459 }, 460 "end": "\\)", 461 "endCaptures": { 462 "0": { 463 "name": "punctuation.section.group.end.powershell" 464 } 465 }, 466 "name": "meta.group.simple.subexpression.powershell", 467 "patterns": [ 468 { 469 "include": "$self" 470 } 471 ] 472 }, 473 "interpolation": { 474 "begin": "(((\\$)))((\\())", 475 "beginCaptures": { 476 "1": { 477 "name": "keyword.other.substatement.powershell" 478 }, 479 "2": { 480 "name": "punctuation.definition.substatement.powershell" 481 }, 482 "3": { 483 "name": "punctuation.section.embedded.substatement.begin.powershell" 484 }, 485 "4": { 486 "name": "punctuation.section.group.begin.powershell" 487 }, 488 "5": { 489 "name": "punctuation.section.embedded.substatement.begin.powershell" 490 } 491 }, 492 "contentName": "interpolated.complex.source.powershell", 493 "end": "(\\))", 494 "endCaptures": { 495 "0": { 496 "name": "punctuation.section.group.end.powershell" 497 }, 498 "1": { 499 "name": "punctuation.section.embedded.substatement.end.powershell" 500 } 501 }, 502 "name": "meta.embedded.substatement.powershell", 503 "patterns": [ 504 { 505 "include": "$self" 506 } 507 ] 508 }, 509 "numericConstant": { 510 "patterns": [ 511 { 512 "captures": { 513 "1": { 514 "name": "constant.numeric.hex.powershell" 515 }, 516 "2": { 517 "name": "keyword.other.powershell" 518 } 519 }, 520 "match": "(?<!\\w)([-+]?0(?:x|X)[0-9a-fA-F_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\\b" 521 }, 522 { 523 "captures": { 524 "1": { 525 "name": "constant.numeric.integer.powershell" 526 }, 527 "2": { 528 "name": "keyword.other.powershell" 529 } 530 }, 531 "match": "(?<!\\w)([-+]?(?:[0-9_]+)?\\.[0-9_]+(?:(?:e|E)[0-9]+)?(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\\b" 532 }, 533 { 534 "captures": { 535 "1": { 536 "name": "constant.numeric.octal.powershell" 537 }, 538 "2": { 539 "name": "keyword.other.powershell" 540 } 541 }, 542 "match": "(?<!\\w)([-+]?0(?:b|B)[01_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\\b" 543 }, 544 { 545 "captures": { 546 "1": { 547 "name": "constant.numeric.integer.powershell" 548 }, 549 "2": { 550 "name": "keyword.other.powershell" 551 } 552 }, 553 "match": "(?<!\\w)([-+]?[0-9_]+(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\\b" 554 }, 555 { 556 "captures": { 557 "1": { 558 "name": "constant.numeric.integer.powershell" 559 }, 560 "2": { 561 "name": "keyword.other.powershell" 562 } 563 }, 564 "match": "(?<!\\w)([-+]?[0-9_]+\\.(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\\b" 565 }, 566 { 567 "captures": { 568 "1": { 569 "name": "constant.numeric.integer.powershell" 570 }, 571 "2": { 572 "name": "keyword.other.powershell" 573 } 574 }, 575 "match": "(?<!\\w)([-+]?[0-9_]+[\\.]?(?:F|f|D|d|M|m))((?i:[kmgtp]b)?)\\b" 576 }, 577 { 578 "captures": { 579 "1": { 580 "name": "constant.numeric.integer.powershell" 581 }, 582 "2": { 583 "name": "keyword.other.powershell" 584 } 585 }, 586 "match": "(?<!\\w)([-+]?[0-9_]+[\\.]?(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\\b" 587 } 588 ] 589 }, 590 "scriptblock": { 591 "begin": "\\{", 592 "beginCaptures": { 593 "0": { 594 "name": "punctuation.section.braces.begin.powershell" 595 } 596 }, 597 "end": "\\}", 598 "endCaptures": { 599 "0": { 600 "name": "punctuation.section.braces.end.powershell" 601 } 602 }, 603 "name": "meta.scriptblock.powershell", 604 "patterns": [ 605 { 606 "include": "$self" 607 } 608 ] 609 }, 610 "type": { 611 "begin": "\\[", 612 "beginCaptures": { 613 "0": { 614 "name": "punctuation.section.bracket.begin.powershell" 615 } 616 }, 617 "end": "\\]", 618 "endCaptures": { 619 "0": { 620 "name": "punctuation.section.bracket.end.powershell" 621 } 622 }, 623 "patterns": [ 624 { 625 "match": "(?!\\d+|\\.)(?:\\p{L}|\\p{N}|\\.)+", 626 "name": "storage.type.powershell" 627 }, 628 { 629 "include": "$self" 630 } 631 ] 632 }, 633 "variable": { 634 "patterns": [ 635 { 636 "captures": { 637 "0": { 638 "name": "constant.language.powershell" 639 }, 640 "1": { 641 "name": "punctuation.definition.variable.powershell" 642 } 643 }, 644 "comment": "These are special constants.", 645 "match": "(\\$)(?i:(False|Null|True))\\b" 646 }, 647 { 648 "captures": { 649 "0": { 650 "name": "support.constant.variable.powershell" 651 }, 652 "1": { 653 "name": "punctuation.definition.variable.powershell" 654 }, 655 "3": { 656 "name": "variable.other.member.powershell" 657 } 658 }, 659 "comment": "These are the other built-in constants.", 660 "match": "(\\$)(?i:(Error|ExecutionContext|Host|Home|PID|PsHome|PsVersionTable|ShellID))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?\\b" 661 }, 662 { 663 "captures": { 664 "0": { 665 "name": "support.variable.automatic.powershell" 666 }, 667 "1": { 668 "name": "punctuation.definition.variable.powershell" 669 }, 670 "3": { 671 "name": "variable.other.member.powershell" 672 } 673 }, 674 "comment": "Automatic variables are not constants, but they are read-only. In monokai (default) color schema support.variable doesn't have color, so we use constant.", 675 "match": "(\\$)((?:[$^?])|(?i:_|Args|ConsoleFileName|Event|EventArgs|EventSubscriber|ForEach|Input|LastExitCode|Matches|MyInvocation|NestedPromptLevel|Profile|PSBoundParameters|PsCmdlet|PsCulture|PSDebugContext|PSItem|PSCommandPath|PSScriptRoot|PsUICulture|Pwd|Sender|SourceArgs|SourceEventArgs|StackTrace|Switch|This)\\b)((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?" 676 }, 677 { 678 "captures": { 679 "0": { 680 "name": "variable.language.powershell" 681 }, 682 "1": { 683 "name": "punctuation.definition.variable.powershell" 684 }, 685 "3": { 686 "name": "variable.other.member.powershell" 687 } 688 }, 689 "comment": "Style preference variables as language variables so that they stand out.", 690 "match": "(\\$)(?i:(ConfirmPreference|DebugPreference|ErrorActionPreference|ErrorView|FormatEnumerationLimit|InformationPreference|LogCommandHealthEvent|LogCommandLifecycleEvent|LogEngineHealthEvent|LogEngineLifecycleEvent|LogProviderHealthEvent|LogProviderLifecycleEvent|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount|MaximumHistoryCount|MaximumVariableCount|OFS|OutputEncoding|PSCulture|PSDebugContext|PSDefaultParameterValues|PSEmailServer|PSItem|PSModuleAutoLoadingPreference|PSModuleAutoloadingPreference|PSSenderInfo|PSSessionApplicationName|PSSessionConfigurationName|PSSessionOption|ProgressPreference|VerbosePreference|WarningPreference|WhatIfPreference))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?\\b" 691 }, 692 { 693 "captures": { 694 "0": { 695 "name": "variable.other.readwrite.powershell" 696 }, 697 "1": { 698 "name": "punctuation.definition.variable.powershell" 699 }, 700 "2": { 701 "name": "storage.modifier.scope.powershell" 702 }, 703 "4": { 704 "name": "variable.other.member.powershell" 705 } 706 }, 707 "match": "(?i:(\\$|@)(global|local|private|script|using|workflow):((?:\\p{L}|\\d|_)+))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?" 708 }, 709 { 710 "captures": { 711 "0": { 712 "name": "variable.other.readwrite.powershell" 713 }, 714 "1": { 715 "name": "punctuation.definition.variable.powershell" 716 }, 717 "2": { 718 "name": "punctuation.section.braces.begin.powershell" 719 }, 720 "3": { 721 "name": "storage.modifier.scope.powershell" 722 }, 723 "5": { 724 "name": "punctuation.section.braces.end.powershell" 725 }, 726 "6": { 727 "name": "variable.other.member.powershell" 728 } 729 }, 730 "match": "(?i:(\\$)(\\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\\}))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?" 731 }, 732 { 733 "captures": { 734 "0": { 735 "name": "variable.other.readwrite.powershell" 736 }, 737 "1": { 738 "name": "punctuation.definition.variable.powershell" 739 }, 740 "2": { 741 "name": "support.variable.drive.powershell" 742 }, 743 "4": { 744 "name": "variable.other.member.powershell" 745 } 746 }, 747 "match": "(?i:(\\$|@)((?:\\p{L}|\\d|_)+:)?((?:\\p{L}|\\d|_)+))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?" 748 }, 749 { 750 "captures": { 751 "0": { 752 "name": "variable.other.readwrite.powershell" 753 }, 754 "1": { 755 "name": "punctuation.definition.variable.powershell" 756 }, 757 "2": { 758 "name": "punctuation.section.braces.begin.powershell" 759 }, 760 "3": { 761 "name": "support.variable.drive.powershell" 762 }, 763 "5": { 764 "name": "punctuation.section.braces.end.powershell" 765 }, 766 "6": { 767 "name": "variable.other.member.powershell" 768 } 769 }, 770 "match": "(?i:(\\$)(\\{)((?:\\p{L}|\\d|_)+:)?([^}]*[^}`])(\\}))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?" 771 } 772 ] 773 }, 774 "UsingDirective": { 775 "match": "(?<!\\w)(?i:(using))\\s+(?i:(namespace|module))\\s+(?i:((?:\\w+(?:\\.)?)+))", 776 "captures": { 777 "1": { 778 "name": "keyword.control.using.powershell" 779 }, 780 "2": { 781 "name": "keyword.other.powershell" 782 }, 783 "3": { 784 "name": "variable.parameter.powershell" 785 } 786 } 787 }, 788 "RequiresDirective": { 789 "begin": "(?<=#)(?i:(requires))\\s", 790 "beginCaptures": { 791 "0": { 792 "name": "keyword.control.requires.powershell" 793 } 794 }, 795 "end": "$", 796 "name": "meta.requires.powershell", 797 "patterns": [ 798 { 799 "match": "\\-(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version|Assembly|PSEdition)", 800 "name": "keyword.other.powershell" 801 }, 802 { 803 "match": "(?<!-)\\b\\p{L}+|\\d+(?:\\.\\d+)*", 804 "name": "variable.parameter.powershell" 805 }, 806 { 807 "include": "#hashtable" 808 } 809 ] 810 }, 811 "variableNoProperty": { 812 "patterns": [ 813 { 814 "captures": { 815 "0": { 816 "name": "constant.language.powershell" 817 }, 818 "1": { 819 "name": "punctuation.definition.variable.powershell" 820 } 821 }, 822 "comment": "These are special constants.", 823 "match": "(\\$)(?i:(False|Null|True))\\b" 824 }, 825 { 826 "captures": { 827 "0": { 828 "name": "support.constant.variable.powershell" 829 }, 830 "1": { 831 "name": "punctuation.definition.variable.powershell" 832 }, 833 "3": { 834 "name": "variable.other.member.powershell" 835 } 836 }, 837 "comment": "These are the other built-in constants.", 838 "match": "(\\$)(?i:(Error|ExecutionContext|Host|Home|PID|PsHome|PsVersionTable|ShellID))\\b" 839 }, 840 { 841 "captures": { 842 "0": { 843 "name": "support.variable.automatic.powershell" 844 }, 845 "1": { 846 "name": "punctuation.definition.variable.powershell" 847 }, 848 "3": { 849 "name": "variable.other.member.powershell" 850 } 851 }, 852 "comment": "Automatic variables are not constants, but they are read-only...", 853 "match": "(\\$)((?:[$^?])|(?i:_|Args|ConsoleFileName|Event|EventArgs|EventSubscriber|ForEach|Input|LastExitCode|Matches|MyInvocation|NestedPromptLevel|Profile|PSBoundParameters|PsCmdlet|PsCulture|PSDebugContext|PSItem|PSCommandPath|PSScriptRoot|PsUICulture|Pwd|Sender|SourceArgs|SourceEventArgs|StackTrace|Switch|This)\\b)" 854 }, 855 { 856 "captures": { 857 "0": { 858 "name": "variable.language.powershell" 859 }, 860 "1": { 861 "name": "punctuation.definition.variable.powershell" 862 }, 863 "3": { 864 "name": "variable.other.member.powershell" 865 } 866 }, 867 "comment": "Style preference variables as language variables so that they stand out.", 868 "match": "(\\$)(?i:(ConfirmPreference|DebugPreference|ErrorActionPreference|ErrorView|FormatEnumerationLimit|InformationPreference|LogCommandHealthEvent|LogCommandLifecycleEvent|LogEngineHealthEvent|LogEngineLifecycleEvent|LogProviderHealthEvent|LogProviderLifecycleEvent|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount|MaximumHistoryCount|MaximumVariableCount|OFS|OutputEncoding|PSCulture|PSDebugContext|PSDefaultParameterValues|PSEmailServer|PSItem|PSModuleAutoLoadingPreference|PSModuleAutoloadingPreference|PSSenderInfo|PSSessionApplicationName|PSSessionConfigurationName|PSSessionOption|ProgressPreference|VerbosePreference|WarningPreference|WhatIfPreference))\\b" 869 }, 870 { 871 "captures": { 872 "0": { 873 "name": "variable.other.readwrite.powershell" 874 }, 875 "1": { 876 "name": "punctuation.definition.variable.powershell" 877 }, 878 "2": { 879 "name": "storage.modifier.scope.powershell" 880 }, 881 "4": { 882 "name": "variable.other.member.powershell" 883 } 884 }, 885 "match": "(?i:(\\$)(global|local|private|script|using|workflow):((?:\\p{L}|\\d|_)+))" 886 }, 887 { 888 "captures": { 889 "0": { 890 "name": "variable.other.readwrite.powershell" 891 }, 892 "1": { 893 "name": "punctuation.definition.variable.powershell" 894 }, 895 "2": { 896 "name": "storage.modifier.scope.powershell" 897 }, 898 "4": { 899 "name": "keyword.other.powershell" 900 }, 901 "5": { 902 "name": "variable.other.member.powershell" 903 } 904 }, 905 "match": "(?i:(\\$)(\\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\\}))" 906 }, 907 { 908 "captures": { 909 "0": { 910 "name": "variable.other.readwrite.powershell" 911 }, 912 "1": { 913 "name": "punctuation.definition.variable.powershell" 914 }, 915 "2": { 916 "name": "support.variable.drive.powershell" 917 }, 918 "4": { 919 "name": "variable.other.member.powershell" 920 } 921 }, 922 "match": "(?i:(\\$)((?:\\p{L}|\\d|_)+:)?((?:\\p{L}|\\d|_)+))" 923 }, 924 { 925 "captures": { 926 "0": { 927 "name": "variable.other.readwrite.powershell" 928 }, 929 "1": { 930 "name": "punctuation.definition.variable.powershell" 931 }, 932 "2": { 933 "name": "punctuation.section.braces.begin" 934 }, 935 "3": { 936 "name": "support.variable.drive.powershell" 937 }, 938 "5": { 939 "name": "punctuation.section.braces.end" 940 } 941 }, 942 "match": "(?i:(\\$)(\\{)((?:\\p{L}|\\d|_)+:)?([^}]*[^}`])(\\}))" 943 } 944 ] 945 }, 946 "hashtable": { 947 "begin": "(@)(\\{)", 948 "beginCaptures": { 949 "1": { 950 "name": "keyword.other.hashtable.begin.powershell" 951 }, 952 "2": { 953 "name": "punctuation.section.braces.begin.powershell" 954 } 955 }, 956 "end": "(\\})", 957 "endCaptures": { 958 "1": { 959 "name": "punctuation.section.braces.end.powershell" 960 } 961 }, 962 "name": "meta.hashtable.powershell", 963 "patterns": [ 964 { 965 "captures": { 966 "1": { 967 "name": "punctuation.definition.string.begin.powershell" 968 }, 969 "2": { 970 "name": "variable.other.readwrite.powershell" 971 }, 972 "3": { 973 "name": "punctuation.definition.string.end.powershell" 974 }, 975 "4": { 976 "name": "keyword.operator.assignment.powershell" 977 } 978 }, 979 "match": "\\b((?:\\'|\\\")?)(\\w+)((?:\\'|\\\")?)(?:\\s+)?(=)(?:\\s+)?", 980 "name": "meta.hashtable.assignment.powershell" 981 }, 982 { 983 "include": "#scriptblock" 984 }, 985 { 986 "include": "$self" 987 } 988 ] 989 }, 990 "doubleQuotedString": { 991 "begin": "[\"\\x{201C}-\\x{201E}]", 992 "beginCaptures": { 993 "0": { 994 "name": "punctuation.definition.string.begin.powershell" 995 } 996 }, 997 "end": "[\"\\x{201C}-\\x{201E}]", 998 "applyEndPatternLast": true, 999 "endCaptures": { 1000 "0": { 1001 "name": "punctuation.definition.string.end.powershell" 1002 } 1003 }, 1004 "name": "string.quoted.double.powershell", 1005 "patterns": [ 1006 { 1007 "match": "(?i)\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,64}\\b" 1008 }, 1009 { 1010 "include": "#variableNoProperty" 1011 }, 1012 { 1013 "include": "#doubleQuotedStringEscapes" 1014 }, 1015 { 1016 "match": "[\"\\x{201C}-\\x{201E}]{2}", 1017 "name": "constant.character.escape.powershell" 1018 }, 1019 { 1020 "include": "#interpolation" 1021 }, 1022 { 1023 "match": "`\\s*$", 1024 "name": "keyword.other.powershell" 1025 } 1026 ] 1027 } 1028 } 1029 }