Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
362 lines (269 sloc) 12.6 KB
{
"name": "Powershell v2",
"scopeName": "source.powershell",
"fileTypes": ["ps1", "psm1", "psd1"],
"foldingStartMarker": "\\{\\s*$",
"foldingStopMarker": "^\\s*\\}",
"patterns": [
{ "begin": "<#",
"beginCaptures": {
"0": { "name": "punctuation.start.definition.comment.block.powershell" }
},
"end": "#>",
"endCaptures": {
"0": { "name": "punctuation.end.definition.comment.block.powershell" }
},
"patterns": [
{ "include": "#commentEmbeddedDocs" }
],
"name": "comment.block.powershell"
},
{ "begin": "#",
"end": "$",
"patterns":[
{ "include": "#commentEmbeddedDocs" }
],
"name": "comment.line.powershell"
},
{ "include": "#variable" },
{ "include": "#scriptblock" },
{ "begin": "(?<!\")\"" ,
"end": "\"(?!\")",
"patterns": [
{ "include": "#variable" },
{ "include": "#doubleQuotedStringEscapes" },
{ "include": "#interpolation" },
{ "match": "`\\s*$",
"name": "keyword.other.powershell"
}
],
"name": "string.quoted.double.powershell"
},
{ "begin": "(?<!')'" ,
"end": "'(?!')",
"patterns": [
{ "match": "''",
"name": "constant.character.escape.powershell"
}
],
"name": "string.quoted.single.powershell"
},
{ "begin": "@\"$",
"end": "^\"@$",
"patterns": [
{ "include": "#interpolation" }
],
"name": "string.quoted.double.heredoc.powershell"
},
{ "begin": "@\\(",
"end": "\\)",
"captures": {
"0": { "name": "keyword.other.powershell" }
},
"patterns": [
{ "include": "$self" }
],
"name": "meta.group.array-expression.powershell"
},
{ "begin": "\\$\\(",
"end": "\\)",
"captures": {
"0": { "name": "keyword.other.powershell" }
},
"patterns": [
{ "include": "$self" }
],
"comment": "TODO: move to repo; make recursive.",
"name": "meta.group.complex.subexpression.powershell"
},
{ "begin": "@'$",
"end": "^'@$",
"name": "string.quoted.double.heredoc.powershell"
},
{ "include": "#numericConstant" },
{
"match": "-([lg][te]|eq|ne)",
"name": "keyword.operator.logical.powershell"
},
{ "include": "#PSDefaults" },
{ "match": "(?i:[a-z][a-z0-9]+-[a-z][a-z0-9]+)",
"name": "support.function.powershell"
},
{ "match": "\\b(?i:if|else|elseif|switch|while|default|for|do|until|break|continue|foreach|return|filter|in|trap|throw|param|begin|process|end|function|global|local|private|script|contained)\\b",
"name": "keyword.control.powershell"
},
{ "match": "-(?i:(?:[ic]?eq|ne|[gl][te]|(?:not)?(?:like|match|contains)|replace)|is(?:not)?|as|and|or|band|bor|not|f)\\b",
"name": "keyword.operator.comparison.powershell"
},
{ "match": "-(?i:and|or|not)|!",
"name": "keyword.operator.logical.powershell"
},
{ "match": "-(?i:f|band|bor|-bnot)\\b",
"name": "keyword.operator.bitwise.powershell"
},
{ "match": "-f\\b",
"name": "keyword.operator.string-format.powershell"
},
{ "match": "[+%*/-]?=|[+/*%-]",
"name": "keyword.operator.assignment.powershell"
},
{ "match": "2>&1|>>|>|<<|<|>|>\\||2>|2>>|1>>",
"name": "keyword.operator.redirection.powershell"
},
{ "match": "\\|{2}|&{2}|;",
"name": "keyword.other.statement-separator.powershell"
},
{ "match": "&|(?<!\\w)\\.(?= )|`|,|\\|",
"name": "keyword.operator.other.powershell"
}
],
"repository": {
"commentEmbeddedDocs": {
"patterns": [
{
"match": "(?i:\\s*(\\.)(SYNOPSIS|DESCRIPTION|EXAMPLE|INPUTS|OUTPUTS|NOTES|LINK|COMPONENT|FUNCTIONALITY))",
"name": "comment.documentation.embedded.powershell",
"captures": {
"1": { "name": "constant.string.documentation.powershell" },
"2": { "name": "keyword.operator.documentation.powershell"}
}
},
{
"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": "keyword.operator.documentation.powershell"}
}
}
]
},
"doubleQuotedStringEscapes": {
"patterns": [
{
"match": "`[0abnfrvt\"'$`]",
"name": "constant.character.escape.powershell"
},
{
"match": "\"\"",
"name": "constant.character.escape.powershell"
}
]
},
"interpolation": {
"begin": "(\\$)\\(",
"end": "\\)",
"contentName": "interpolated.complex.source.powershell",
"beginCaptures": {
"0": { "name": "keyword.other.powershell" }
},
"endCaptures": {
"0": { "name": "keyword.other.powershell" }
},
"patterns": [
{ "include": "$self" },
{ "include": "#interpolation" },
{ "include": "#interpolatedStringContent" }
]
},
"interpolatedStringContent": {
"begin": "\\(",
"end": "\\)",
"contentName": "interpolated.simple.source.powershell",
"beginCaptures": {
"0": { "name": "keyword.other.powershell" }
},
"endCaptures": {
"0": { "name": "keyword.other.powershell" }
},
"patterns": [
{ "include": "$self" },
{ "include": "#interpolation" },
{ "include": "#interpolatedStringContent" }
]
},
"variable": {
"patterns": [
{
"match": "(\\$)(?i:(\\$|\\?|\\^|args|ConfirmPreference|ConsoleFileName|DebugPreference|Error|ErrorActionPreference|ErrorView|ExecutionContext|false|FormatEnumerationLimit|HOME|Host|input|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount|MaximumHistoryCount|MaximumVariableCount|MyInvocation|NestedPromptLevel|null|OutputEncoding|PID|PROFILE|ProgressPreference|PSBoundParameters|PSCulture|PSEmailServer|PSHOME|PSSessionApplicationName|PSSessionConfigurationName|PSSessionOption|PSUICulture|PSVersionTable|PWD|ReportErrorShowExceptionClass|ReportErrorShowInnerException|ReportErrorShowSource|ReportErrorShowStackTrace|ShellId|StackTrace|true|VerbosePreference|WarningPreference|WhatIfPreference))",
"name": "support.variable.builtin.powershell",
"captures": {
"1": { "name": "keyword.other.powershell" },
"2": { "name": "constant.numeric.powershell" }
},
"comment": "Style var name as numeric constant so that they stand out."
},
{
"match": "(?i:(\\$)(?:(private|script|global):)?([a-z0-9_]+))",
"captures": {
"1": { "name": "keyword.other.variable.powershell" },
"2": { "name": "storage.modifier.scope.powershell" },
"3": { "name": "variable.other.readwrite.powershell" }
}
},
{
"match": "(?i:(\\$)(\\{(?:(private|script|global):)?.+\\}))",
"captures": {
"1": { "name": "keyword.other.variable.powershell" },
"2": { "name": "variable.other.readwrite.powershell" },
"3": { "name": "storage.modifier.scope.powershell" }
}
}
]
},
"numericConstant": {
"patterns": [
{
"match": "(?i:\\d+(E)(\\+|\\-)\\d+(d)?(mb|kb|gb)?)",
"name": "constant.numeric.scientific.powershell",
"captures": {
"1": { "name": "support.constant.powershell" },
"2": { "name": "keyword.operator.math.powershell" },
"3": { "name": "support.constant.powershell" },
"4": { "name": "keyword.other.powershell" }
}
},
{
"match": "(?i:(0x)[a-f0-9]+(mb|kb|gb)?)",
"name": "constant.numeric.hexadecimal.powershell",
"captures": {
"1": { "name": "support.constant.powershell" },
"2": { "name": "keyword.other.powershell" }
}
},
{
"match": "\\d*(?<!\\.)(\\.)\\d+(d)?(mb|kb|gb)?",
"name": "constant.numeric.double.powershell",
"captures": {
"1": { "name": "support.constant.powershell" },
"2": { "name": "support.constant.powershell" },
"3": { "name": "keyword.other.powershell" }
}
},
{
"match": "(?<!\\w)\\d+(d)?(mb|kb|gb)?(?!\\w)",
"name": "constant.numeric.powershell",
"captures": {
"1": { "name": "support.constant.powershell" },
"2": { "name": "keyword.other.powershell" }
}
}
]
},
"scriptblock": {
"begin": "\\{",
"end": "\\}",
"name": "meta.scriptblock.powershell",
"patterns": [
{ "include": "$self" }
]
},
"PSDefaults": {
"match": "Disconnect-(WSMan)|Exit-(PSSession)|Copy-(Item|ItemProperty)|Resolve-(Path)|Group-(Object)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|Variable|WmiObject|WSManInstance)|Unregister-(Event|PSSessionConfiguration)|Tee-(Object)|Pop-(Location)|Set-(Acl|Alias|AuthenticodeSignature|Content|Date|ExecutionPolicy|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance|WSManInstance|WSManQuickConfig)|Format-(Custom|List|Table|Wide)|Invoke-(Command|Expression|History|Item|WmiMethod|WSManAction)|Export-(Alias|Clixml|Console|Counter|Csv|FormatData|ModuleMember|PSSession)|Update-(FormatData|List|TypeData)|Sort-(Object)|Measure-(Command|Object)|ForEach-(Object)|Connect-(WSMan)|Suspend-(Service)|ConvertFrom-(Csv|SecureString|StringData)|Where-(Object)|Rename-(Item|ItemProperty)|Convert-(Path)|Select-(Object|String|Xml)|Import-(Alias|Clixml|Counter|Csv|LocalizedData|Module|PSSession)|Stop-(Computer|Job|Process|Service|Transcript)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionOption|Service|TimeSpan|Variable|WebServiceProxy|WSManInstance|WSManSessionOption)|Resume-(Service)|Show-(EventLog)|Out-(Default|File|GridView|Host|Null|Printer|String)|Undo-(Transaction)|Trace-(Command)|Clear-(Content|EventLog|History|Item|ItemProperty|Variable)|Push-(Location)|Split-(Path)|Disable-(ComputerRestore|PSBreakpoint|PSSessionConfiguration|WSManCredSSP)|Reset-(ComputerMachinePassword)|Restore-(Computer)|ConvertTo-(Csv|Html|SecureString|Xml)|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration|WSManCredSSP)|Join-(Path)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Compare-(Object)|Get-(Acl|Alias|AuthenticodeSignature|ChildItem|Command|ComputerRestorePoint|Content|Counter|Credential|Culture|Date|Event|EventLog|EventSubscriber|ExecutionPolicy|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|PfxCertificate|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|UICulture|Unique|Variable|WinEvent|WmiObject|WSManCredSSP|WSManInstance)|Receive-(Job)|Move-(Item|ItemProperty)|Add-(Computer|Content|History|Member|PSSnapin|Type)|Wait-(Event|Job|Process)|Send-(MailMessage)|Read-(Host)|Complete-(Transaction)|Checkpoint-(Computer)|Debug-(Process)|Use-(Transaction)|Restart-(Computer|Service)|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning)|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|WSMan)|Start-(Job|Process|Service|Sleep|Transaction|Transcript)|Limit-(EventLog)|Enter-(PSSession)",
"name": "support.function.builtin.powershell",
"comment": "Default commandlets in Powershell v2"
}
},
"uuid": "f8f5ffb0-503e-11df-9879-0800200c9a66"
}