mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 09:18:59 +00:00
[powershell] Update PowerShell Editor Syntax. Fixes #49789
This commit is contained in:
parent
e142962e1b
commit
844c7f1c94
|
@ -4,7 +4,7 @@
|
|||
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
|
||||
"Once accepted there, we are happy to receive an update request."
|
||||
],
|
||||
"version": "https://github.com/PowerShell/EditorSyntax/commit/90e4b5454f2f1cc06eae4c6c8e12c33d9f5f3a8c",
|
||||
"version": "https://github.com/PowerShell/EditorSyntax/commit/e6e207044299a7121b4ed92c9762f51e1c23d0dd",
|
||||
"name": "PowerShell",
|
||||
"scopeName": "source.powershell",
|
||||
"patterns": [
|
||||
|
@ -35,6 +35,9 @@
|
|||
"patterns": [
|
||||
{
|
||||
"include": "#commentEmbeddedDocs"
|
||||
},
|
||||
{
|
||||
"include": "#RequiresDirective"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -57,9 +60,15 @@
|
|||
{
|
||||
"include": "#attribute"
|
||||
},
|
||||
{
|
||||
"include": "#UsingDirective"
|
||||
},
|
||||
{
|
||||
"include": "#type"
|
||||
},
|
||||
{
|
||||
"include": "#hashtable"
|
||||
},
|
||||
{
|
||||
"begin": "(?<!(?<!`)\")\"",
|
||||
"end": "\"(?!\")",
|
||||
|
@ -165,9 +174,14 @@
|
|||
"name": "support.function.powershell"
|
||||
},
|
||||
{
|
||||
"match": "(?<!\\w)((?i:begin|break|catch|continue|data|define|do|dynamicparam|else|elseif|end|exit|finally|for|foreach(?!-object)|from|if|in|inlinescript|parallel|param|process|return|switch|throw|trap|try|until|using|var|where(?!-object)|while)|%|\\?)(?!\\w)",
|
||||
"match": "(?<!\\w)((?i:begin|break|catch|continue|data|define|do|dynamicparam|else|elseif|end|exit|finally|for|foreach(?!-object)|from|if|in|inlinescript|parallel|param|process|return|switch|throw|trap|try|until|var|where(?!-object)|while)|%|\\?)(?!\\w)",
|
||||
"name": "keyword.control.powershell"
|
||||
},
|
||||
{
|
||||
"comment": "This should only be relevant inside a class but will require a rework of how classes are matched. This is a temp fix.",
|
||||
"match": "(?<!\\w)((?i:hidden|static))(?!\\w)",
|
||||
"name": "storage.modifier.powershell"
|
||||
},
|
||||
{
|
||||
"captures": {
|
||||
"1": {
|
||||
|
@ -272,7 +286,7 @@
|
|||
"patterns": [
|
||||
{
|
||||
"comment": "Verb-Noun pattern:",
|
||||
"match": "(?:(\\p{L}|\\d|_|-|\\\\|\\:)*\\\\)?\\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:exe|cmd|bat|ps1))?\\b",
|
||||
"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",
|
||||
"name": "support.function.powershell"
|
||||
},
|
||||
{
|
||||
|
@ -284,6 +298,16 @@
|
|||
"comment": "Builtin cmdlets with reserved verbs",
|
||||
"match": "(?<!\\w)(?i:where-object)(?!\\w)",
|
||||
"name": "support.function.powershell"
|
||||
},
|
||||
{
|
||||
"comment": "Builtin cmdlets with reserved verbs",
|
||||
"match": "(?<!\\w)(?i:sort-object)(?!\\w)",
|
||||
"name": "support.function.powershell"
|
||||
},
|
||||
{
|
||||
"comment": "Builtin cmdlets with reserved verbs",
|
||||
"match": "(?<!\\w)(?i:tee-object)(?!\\w)",
|
||||
"name": "support.function.powershell"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -298,7 +322,7 @@
|
|||
"name": "keyword.operator.documentation.powershell"
|
||||
}
|
||||
},
|
||||
"match": "(?i:\\s*(\\.)(SYNOPSIS|DESCRIPTION|EXAMPLE|INPUTS|OUTPUTS|NOTES|LINK|COMPONENT|FUNCTIONALITY))",
|
||||
"match": "(?i:\\s*(\\.)(COMPONENT|DESCRIPTION|EXAMPLE|EXTERNALHELP|FORWARDHELPCATEGORY|FORWARDHELPTARGETNAME|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|REMOTEHELPRUNSPACE|ROLE|SYNOPSIS))",
|
||||
"name": "comment.documentation.embedded.powershell"
|
||||
},
|
||||
{
|
||||
|
@ -315,21 +339,6 @@
|
|||
},
|
||||
"match": "(?i:\\s*(\\.)(PARAMETER|FORWARDHELPTARGETNAME|FORWARDHELPCATEGORY|REMOTEHELPRUNSPACE|EXTERNALHELP)\\s+([a-z0-9-_]+))",
|
||||
"name": "comment.documentation.embedded.powershell"
|
||||
},
|
||||
{
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.string.documentation.powershell"
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.operator.documentation.powershell"
|
||||
},
|
||||
"3": {
|
||||
"name": "string.quoted.double.heredoc.powershell"
|
||||
}
|
||||
},
|
||||
"match": "(?i:requires\\s+-(Version\\s+\\d(.\\d+)?|Assembly\\s+(.*)|Module\\s+(.*)|PsSnapIn\\s+(.*)|ShellId\\s+(.*)))",
|
||||
"name": "comment.documentation.embedded.powershell"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -346,7 +355,7 @@
|
|||
]
|
||||
},
|
||||
"function": {
|
||||
"begin": "(?<!\\S)(?i)(function|filter|configuration|workflow)\\s+(?:(global|local|script|private):)?((?:\\p{L}|\\d|_|-|\\.)+)",
|
||||
"begin": "^(?:\\s*+)(?i)(function|filter|configuration|workflow)\\s+(?:(global|local|script|private):)?((?:\\p{L}|\\d|_|-|\\.)+)",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "meta.function"
|
||||
|
@ -420,38 +429,86 @@
|
|||
{
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.operator.math.powershell"
|
||||
"name": "constant.numeric.hexadecimal.powershell"
|
||||
},
|
||||
"2": {
|
||||
"name": "support.constant.powershell"
|
||||
},
|
||||
"3": {
|
||||
"name": "keyword.other.powershell"
|
||||
}
|
||||
},
|
||||
"match": "(?<!\\w)(?i:(0x)([a-f0-9]+)((?i:L)?(?i:[kmgtp]b)?))(?!\\w)",
|
||||
"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",
|
||||
"name": "constant.numeric.hexadecimal.powershell"
|
||||
},
|
||||
{
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "support.constant.powershell"
|
||||
"name": "constant.numeric.scientific.powershell"
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.operator.math.powershell"
|
||||
},
|
||||
"3": {
|
||||
"name": "support.constant.powershell"
|
||||
},
|
||||
"4": {
|
||||
"name": "keyword.other.powershell"
|
||||
},
|
||||
"5": {
|
||||
"name": "keyword.other.powershell"
|
||||
}
|
||||
},
|
||||
"match": "(?<!\\w)(?i:(\\d*\\.?\\d+)(?:((?i:E)[+-]?)(\\d+))?((?i:[DL])?)((?i:[kmgtp]b)?))(?!\\w)",
|
||||
"match": "(?<!\\w)([-+]?(?:[0-9_]+)?\\.[0-9_]+(?:(?:e|E)[0-9]+)?(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\\b",
|
||||
"name": "constant.numeric.scientific.powershell"
|
||||
},
|
||||
{
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.numeric.binary.powershell"
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.other.powershell"
|
||||
}
|
||||
},
|
||||
"match": "(?<!\\w)([-+]?0(?:b|B)[01_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\\b",
|
||||
"name": "constant.numeric.binary.powershell"
|
||||
},
|
||||
{
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.numeric.decimal.powershell"
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.other.powershell"
|
||||
}
|
||||
},
|
||||
"match": "(?<!\\w)([-+]?[0-9_]+(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\\b",
|
||||
"name": "constant.numeric.decimal.powershell"
|
||||
},
|
||||
{
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.numeric.decimal.powershell"
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.other.powershell"
|
||||
}
|
||||
},
|
||||
"match": "(?<!\\w)([-+]?[0-9_]+\\.(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\\b",
|
||||
"name": "constant.numeric.decimal.powershell"
|
||||
},
|
||||
{
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.numeric.decimal.powershell"
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.other.powershell"
|
||||
}
|
||||
},
|
||||
"match": "(?<!\\w)([-+]?[0-9_]+[\\.]?(?:F|f|D|d|M|m))((?i:[kmgtp]b)?)\\b",
|
||||
"name": "constant.numeric.decimal.powershell"
|
||||
},
|
||||
{
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.numeric.decimal.powershell"
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.other.powershell"
|
||||
}
|
||||
},
|
||||
"match": "(?<!\\w)([-+]?[0-9_]+[\\.]?(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\\b",
|
||||
"name": "constant.numeric.decimal.powershell"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -563,7 +620,7 @@
|
|||
"name": "entity.name.function.invocation.powershell"
|
||||
}
|
||||
},
|
||||
"match": "(?i:(\\$)(global|local|private|script|using|workflow):((?:\\p{L}|\\d|_)+))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
|
||||
"match": "(?i:(\\$|@)(global|local|private|script|using|workflow):((?:\\p{L}|\\d|_)+))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
|
||||
},
|
||||
{
|
||||
"captures": {
|
||||
|
@ -600,7 +657,7 @@
|
|||
"name": "entity.name.function.invocation.powershell"
|
||||
}
|
||||
},
|
||||
"match": "(?i:(\\$)((?:\\p{L}|\\d|_)+:)?((?:\\p{L}|\\d|_)+))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
|
||||
"match": "(?i:(\\$|@)((?:\\p{L}|\\d|_)+:)?((?:\\p{L}|\\d|_)+))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
|
||||
},
|
||||
{
|
||||
"captures": {
|
||||
|
@ -624,6 +681,43 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"UsingDirective": {
|
||||
"match": "(?<!\\w)(?i:(using))\\s+(?i:(namespace|module))\\s+(?i:((?:\\w+(?:\\.)?)+))",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.control.using.powershell"
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.other.powershell"
|
||||
},
|
||||
"3": {
|
||||
"name": "variable.parameter.powershell"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RequiresDirective": {
|
||||
"begin": "(?<=#)(?i:(requires))\\s",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "keyword.control.requires.powershell"
|
||||
}
|
||||
},
|
||||
"end": "$",
|
||||
"name": "meta.requires.powershell",
|
||||
"patterns": [
|
||||
{
|
||||
"match": "\\-(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version)",
|
||||
"name": "keyword.other.powershell"
|
||||
},
|
||||
{
|
||||
"match": "(?<!-)\\b\\p{L}+|\\d+(?:\\.\\d+)*",
|
||||
"name": "variable.parameter.powershell"
|
||||
},
|
||||
{
|
||||
"include": "#hashtable"
|
||||
}
|
||||
]
|
||||
},
|
||||
"variableNoProperty": {
|
||||
"patterns": [
|
||||
{
|
||||
|
@ -698,7 +792,7 @@
|
|||
"name": "entity.name.function.invocation.powershell"
|
||||
}
|
||||
},
|
||||
"match": "(?i:(\\$)(global|local|private|script|using|workflow):((?:\\p{L}|\\d|_)+))"
|
||||
"match": "(?i:(\\$|@)(global|local|private|script|using|workflow):((?:\\p{L}|\\d|_)+))"
|
||||
},
|
||||
{
|
||||
"captures": {
|
||||
|
@ -758,6 +852,47 @@
|
|||
"match": "(?i:(\\$\\{)((?:\\p{L}|\\d|_)+:)?([^}]*[^}`])(\\}))"
|
||||
}
|
||||
]
|
||||
},
|
||||
"hashtable": {
|
||||
"begin": "(@\\{)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.section.braces.begin"
|
||||
}
|
||||
},
|
||||
"end": "(\\})",
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.section.braces.end"
|
||||
}
|
||||
},
|
||||
"name": "meta.hashtable.powershell",
|
||||
"patterns": [
|
||||
{
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.string.begin"
|
||||
},
|
||||
"2": {
|
||||
"name": "variable.other.readwrite.powershell"
|
||||
},
|
||||
"3": {
|
||||
"name": "punctuation.definition.string.end"
|
||||
},
|
||||
"4": {
|
||||
"name": "keyword.operator.assignment.powershell"
|
||||
}
|
||||
},
|
||||
"match": "\\b((?:\\'|\\\")?)(\\w+)((?:\\'|\\\")?)(?:\\s+)?(=)(?:\\s+)?",
|
||||
"name": "meta.hashtable.assignment.powershell"
|
||||
},
|
||||
{
|
||||
"include": "#scriptblock"
|
||||
},
|
||||
{
|
||||
"include": "$self"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1233,7 +1233,7 @@
|
|||
},
|
||||
{
|
||||
"c": "1",
|
||||
"t": "source.powershell interpolated.simple.source.powershell constant.numeric.scientific.powershell support.constant.powershell",
|
||||
"t": "source.powershell interpolated.simple.source.powershell constant.numeric.decimal.powershell constant.numeric.decimal.powershell",
|
||||
"r": {
|
||||
"dark_plus": "constant.numeric: #B5CEA8",
|
||||
"light_plus": "constant.numeric: #09885A",
|
||||
|
@ -1310,7 +1310,7 @@
|
|||
},
|
||||
{
|
||||
"c": "2",
|
||||
"t": "source.powershell interpolated.simple.source.powershell constant.numeric.scientific.powershell support.constant.powershell",
|
||||
"t": "source.powershell interpolated.simple.source.powershell constant.numeric.decimal.powershell constant.numeric.decimal.powershell",
|
||||
"r": {
|
||||
"dark_plus": "constant.numeric: #B5CEA8",
|
||||
"light_plus": "constant.numeric: #09885A",
|
||||
|
|
Loading…
Reference in a new issue