Last active
November 8, 2019 18:23
-
-
Save i-ScriptALot/cc4d0d40367f02e23e48e413bef8cae6 to your computer and use it in GitHub Desktop.
Vs-Code-Sync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2019-11-08T18:23:41.702Z","extensionVersion":"v3.4.3"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"metadata": { | |
"id": "819a23e1-b6c6-41cf-9029-e653b537d996", | |
"publisherId": "ms-vscode.azure-account", | |
"publisherDisplayName": "ms-vscode" | |
}, | |
"name": "azure-account", | |
"publisher": "ms-vscode", | |
"version": "0.8.7" | |
}, | |
{ | |
"metadata": { | |
"id": "7a0110bb-231a-4598-aa1b-0769ea46d28b", | |
"publisherId": "aaron-bond.better-comments", | |
"publisherDisplayName": "aaron-bond" | |
}, | |
"name": "better-comments", | |
"publisher": "aaron-bond", | |
"version": "2.0.5" | |
}, | |
{ | |
"metadata": { | |
"id": "a6a0c5b2-d078-4bf5-a9ee-4e37054414b3", | |
"publisherId": "formulahendry.code-runner", | |
"publisherDisplayName": "formulahendry" | |
}, | |
"name": "code-runner", | |
"publisher": "formulahendry", | |
"version": "0.9.14" | |
}, | |
{ | |
"metadata": { | |
"id": "e337c67b-55c2-4fef-8949-eb260e7fb7fd", | |
"publisherId": "Shan.code-settings-sync", | |
"publisherDisplayName": "Shan" | |
}, | |
"name": "code-settings-sync", | |
"publisher": "Shan", | |
"version": "3.4.3" | |
}, | |
{ | |
"metadata": { | |
"id": "aae00486-7e92-42b3-91b0-2b419e4f3875", | |
"publisherId": "vincaslt.highlight-matching-tag", | |
"publisherDisplayName": "vincaslt" | |
}, | |
"name": "highlight-matching-tag", | |
"publisher": "vincaslt", | |
"version": "0.9.5" | |
}, | |
{ | |
"metadata": { | |
"id": "7b71fc1b-190d-4f7d-95d1-93e422649b0a", | |
"publisherId": "Zignd.html-css-class-completion", | |
"publisherDisplayName": "Zignd" | |
}, | |
"name": "html-css-class-completion", | |
"publisher": "Zignd", | |
"version": "1.19.0" | |
}, | |
{ | |
"metadata": { | |
"id": "76fbde36-77d4-4688-b1f8-202727442961", | |
"publisherId": "tht13.html-preview-vscode", | |
"publisherDisplayName": "tht13" | |
}, | |
"name": "html-preview-vscode", | |
"publisher": "tht13", | |
"version": "0.2.5" | |
}, | |
{ | |
"metadata": { | |
"id": "be992f3f-9f22-4b66-a1d2-ecad04c28a28", | |
"publisherId": "abusaidm.html-snippets", | |
"publisherDisplayName": "abusaidm" | |
}, | |
"name": "html-snippets", | |
"publisher": "abusaidm", | |
"version": "0.2.1" | |
}, | |
{ | |
"metadata": { | |
"id": "f45dc69c-8d62-4ea1-b01f-3ab90854acb6", | |
"publisherId": "sidthesloth.html5-boilerplate", | |
"publisherDisplayName": "sidthesloth" | |
}, | |
"name": "html5-boilerplate", | |
"publisher": "sidthesloth", | |
"version": "1.0.3" | |
}, | |
{ | |
"metadata": { | |
"id": "5db78037-f674-459f-a236-db622c427c5b", | |
"publisherId": "PKief.material-icon-theme", | |
"publisherDisplayName": "PKief" | |
}, | |
"name": "material-icon-theme", | |
"publisher": "PKief", | |
"version": "3.9.1" | |
}, | |
{ | |
"metadata": { | |
"id": "e552c70b-32af-4b0b-8f48-5e7e01e688b0", | |
"publisherId": "peakchen90.open-html-in-browser", | |
"publisherDisplayName": "peakchen90" | |
}, | |
"name": "open-html-in-browser", | |
"publisher": "peakchen90", | |
"version": "2.1.0" | |
}, | |
{ | |
"metadata": { | |
"id": "40d39ce9-c381-47a0-80c8-a6661f731eab", | |
"publisherId": "ms-vscode.powershell", | |
"publisherDisplayName": "ms-vscode" | |
}, | |
"name": "powershell", | |
"publisher": "ms-vscode", | |
"version": "2019.11.0" | |
}, | |
{ | |
"metadata": { | |
"id": "a7410310-39ff-47fb-9b36-372025ef8c9a", | |
"publisherId": "ironmansoftware.powershellprotools", | |
"publisherDisplayName": "ironmansoftware" | |
}, | |
"name": "powershellprotools", | |
"publisher": "ironmansoftware", | |
"version": "5.0.6" | |
}, | |
{ | |
"metadata": { | |
"id": "7ed7bccd-f358-4c6f-88c0-1296185abaa1", | |
"publisherId": "chrmarti.regex", | |
"publisherDisplayName": "chrmarti" | |
}, | |
"name": "regex", | |
"publisher": "chrmarti", | |
"version": "0.2.0" | |
}, | |
{ | |
"metadata": { | |
"id": "dda49fd5-1f3b-4d25-bf61-4fc41905ede5", | |
"publisherId": "humao.rest-client", | |
"publisherDisplayName": "humao" | |
}, | |
"name": "rest-client", | |
"publisher": "humao", | |
"version": "0.22.2" | |
}, | |
{ | |
"metadata": { | |
"id": "e5fd2b56-1637-4d4f-8252-6c9d416f9a28", | |
"publisherId": "RobbOwen.synthwave-vscode", | |
"publisherDisplayName": "RobbOwen" | |
}, | |
"name": "synthwave-vscode", | |
"publisher": "RobbOwen", | |
"version": "0.0.7" | |
}, | |
{ | |
"metadata": { | |
"id": "186ace18-2b44-490d-863e-0bd29b229a27", | |
"publisherId": "formulahendry.terminal", | |
"publisherDisplayName": "formulahendry" | |
}, | |
"name": "terminal", | |
"publisher": "formulahendry", | |
"version": "0.0.10" | |
}, | |
{ | |
"metadata": { | |
"id": "86fa6593-3f3e-484c-b7cd-00ba7c91c23f", | |
"publisherId": "bceskavich.theme-dracula-at-night", | |
"publisherDisplayName": "bceskavich" | |
}, | |
"name": "theme-dracula-at-night", | |
"publisher": "bceskavich", | |
"version": "2.5.0" | |
}, | |
{ | |
"metadata": { | |
"id": "dffaf5a1-2219-434b-9d87-cb586fd59260", | |
"publisherId": "Equinusocio.vsc-material-theme", | |
"publisherDisplayName": "Equinusocio" | |
}, | |
"name": "vsc-material-theme", | |
"publisher": "Equinusocio", | |
"version": "30.0.0" | |
}, | |
{ | |
"metadata": { | |
"id": "1b160753-ae5e-42bb-82ad-d115ce5c10f4", | |
"publisherId": "be5invis.vscode-custom-css", | |
"publisherDisplayName": "be5invis" | |
}, | |
"name": "vscode-custom-css", | |
"publisher": "be5invis", | |
"version": "3.0.8" | |
}, | |
{ | |
"metadata": { | |
"id": "8699dfcb-4beb-4760-b976-c46dcdd87df2", | |
"publisherId": "KnisterPeter.vscode-github", | |
"publisherDisplayName": "KnisterPeter" | |
}, | |
"name": "vscode-github", | |
"publisher": "KnisterPeter", | |
"version": "0.30.3" | |
}, | |
{ | |
"metadata": { | |
"id": "aaee577c-f062-495a-9816-0cbd442f1d25", | |
"publisherId": "ecmel.vscode-html-css", | |
"publisherDisplayName": "ecmel" | |
}, | |
"name": "vscode-html-css", | |
"publisher": "ecmel", | |
"version": "0.2.3" | |
}, | |
{ | |
"metadata": { | |
"id": "9ccc1dd7-7ec4-4a46-bd4f-7d7b8b9d322a", | |
"publisherId": "vscode-icons-team.vscode-icons", | |
"publisherDisplayName": "vscode-icons-team" | |
}, | |
"name": "vscode-icons", | |
"publisher": "vscode-icons-team", | |
"version": "9.5.0" | |
}, | |
{ | |
"metadata": { | |
"id": "69ddd764-339a-4ecc-97c1-9c4ece58e36d", | |
"publisherId": "GitHub.vscode-pull-request-github", | |
"publisherDisplayName": "GitHub" | |
}, | |
"name": "vscode-pull-request-github", | |
"publisher": "GitHub", | |
"version": "0.12.0" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place your settings in this file to overwrite default and user settings. | |
{ | |
"editor.tabSize": 4, | |
"editor.insertSpaces": true, | |
"files.trimTrailingWhitespace": true, | |
"files.defaultLanguage": "powershell", | |
// Add a visual ruler for the typescript linting line length | |
"editor.rulers": [120], | |
"files.associations": { | |
// Use JSONC instead of JSON because (1) that's how VS Code interprets snippet files, and (2) it enables better source documentation. | |
"**/snippets/*.json": "jsonc" | |
}, | |
"search.exclude": { | |
"**/node_modules": true, | |
"**/bower_components": true, | |
"logs/": true, | |
"out/": true | |
}, | |
// Lock the TypeScript SDK path to the version we use | |
"typescript.tsdk": "./node_modules/typescript/lib", | |
"workbench.colorTheme": "SynthWave '84", | |
"vscode_custom_css.imports": [ | |
"file:///C:/Users/Admin/.vscode/extensions/robbowen.synthwave-vscode-0.0.7/synthwave84.css" | |
], | |
"editor.minimap.enabled": true, | |
"window.zoomLevel": 2, | |
"powershell.scriptAnalysis.settingsPath": "C:\\Users\\Admin\\.vscode\\extensions\\ms-vscode.powershell-2019.5.0\\examples\\PSScriptAnalyzerSettings.psd1", | |
"team.showWelcomeMessage": false, | |
"vsicons.dontShowNewVersionMessage": true, | |
"editor.formatOnPaste": true, | |
"editor.formatOnType": true, | |
"terminal.integrated.copyOnSelection": true, | |
"terminal.integrated.cursorBlinking": true, | |
"terminal.integrated.cursorStyle": "line", | |
"telemetry.enableTelemetry": false, | |
"powershell.codeFormatting.newLineAfterCloseBrace": false, | |
"powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline", | |
"powershell.codeFormatting.preset": "Stroustrup", | |
"powershell.codeFormatting.useCorrectCasing": true, | |
"powershell.debugging.createTemporaryIntegratedConsole": true, | |
"powershell.helpCompletion": "LineComment", | |
"powershell.integratedConsole.focusConsoleOnExecute": false, | |
"code-runner.clearPreviousOutput": true, | |
"editor.cursorSurroundingLines": 2, | |
"editor.renderControlCharacters": true, | |
"sync.gist": "cc4d0d40367f02e23e48e413bef8cae6", | |
"sync.forceDownload": true, | |
"sync.forceUpload": true, | |
"sync.quietSync": true, | |
"sync.autoDownload": true, | |
"sync.autoUpload": true | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Place your snippets for html here. Each snippet is defined under a snippet name and has a prefix, body and | |
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
// same ids are connected. | |
// Example: | |
// "Print to console": { | |
// "prefix": "log", | |
// "body": [ | |
// "console.log('$1');", | |
// "$2" | |
// ], | |
// "description": "Log output to console" | |
// } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Place your snippets for powershell here. Each snippet is defined under a snippet name and has a prefix, body and | |
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
// same ids are connected. | |
// Example: | |
// "Print to console": { | |
// "prefix": "log", | |
// "body": [ | |
// "console.log('$1');", | |
// "$2" | |
// ], | |
// "description": "Log output to console" | |
// } | |
"Condition statement": { | |
"prefix": "cond", | |
"body": [ | |
"${_} { ${0}; break }" | |
], | |
"description": "Switch condition statement" | |
}, | |
"Condition single quoted string statement": { | |
"prefix": "condsqstr", | |
"body": [ | |
"'${_}' { ${0}; break }" | |
], | |
"description": "Switch condition single quoted string statement" | |
}, | |
"Condition double quoted string statement": { | |
"prefix": "conddqstr", | |
"body": [ | |
"\"${_}\" { ${0}; break }" | |
], | |
"description": "Switch condition double quoted string statement" | |
}, | |
"Condition expression statement": { | |
"prefix": "condexpr", | |
"body": [ | |
"{${_}} { ${0}; break }" | |
], | |
"description": "Switch condition expression statement" | |
}, | |
"Do...while loop": { | |
"prefix": "do", | |
"body": [ | |
"do {", | |
"\t$0", | |
"} while (${$variable});" | |
], | |
"description": "Do...while loop" | |
}, | |
"Do...until loop": { | |
"prefix": "do", | |
"body": [ | |
"do {", | |
"\t$0", | |
"} until (${$variable});" | |
], | |
"description": "Do...until loop" | |
}, | |
"Else statement": { | |
"prefix": "else", | |
"body": [ | |
"else {", | |
"\t$0", | |
"}" | |
], | |
"description": "Else statement" | |
}, | |
"ElseIf statement": { | |
"prefix": "elseif", | |
"body": [ | |
"elseif (${$variable}) {", | |
"\t$0", | |
"}" | |
], | |
"description": "Elseif statement" | |
}, | |
"Foreach statement": { | |
"prefix": "foreach", | |
"body": [ | |
"foreach (${$item} in ${$collection}) {", | |
"\t$0", | |
"}" | |
], | |
"description": "Foreach statement" | |
}, | |
"For loop": { | |
"prefix": "for", | |
"body": [ | |
"for (${$i} = 0; ${$i} -lt ${$length}; ${$i}++) {", | |
"\t$0", | |
"}" | |
], | |
"description": "For loop" | |
}, | |
"If statement": { | |
"prefix": "if", | |
"body": [ | |
"if (${$variable}) {", | |
"\t$0", | |
"}" | |
], | |
"description": "If statement" | |
}, | |
"Reverse for loop": { | |
"prefix": "forr", | |
"body": [ | |
"for (${$i} = ${$length} - 1; ${$i} -ge 0; ${$i}--) {", | |
"\t$0", | |
"}" | |
], | |
"description": "Reverse for loop" | |
}, | |
"Switch statement": { | |
"prefix": "switch", | |
"body": [ | |
"switch (${$variable}) {", | |
"\t${condition} { ${action}; break }", | |
"\tDefault {}", | |
"}" | |
], | |
"description": "Switch statement" | |
}, | |
"Try catch": { | |
"prefix": "try", | |
"body": [ | |
"try {", | |
"\t${_}", | |
"}", | |
"catch [${System.Exception}] {", | |
"\t# Exception is stored in the automatic variable $_", | |
"\t$0", | |
"}" | |
], | |
"description": "Try catch" | |
}, | |
"Try catch finally": { | |
"prefix": "trycf", | |
"body": [ | |
"try {", | |
"\t${_}", | |
"}", | |
"catch [${System.Exception}] {", | |
"\t# Exception is stored in the automatic variable $_", | |
"\t$0", | |
"}", | |
"finally {", | |
"\t$1", | |
"}" ], | |
"description": "Try catch finally" | |
}, | |
"Try finallly": { | |
"prefix": "tryf", | |
"body": [ | |
"try {", | |
"\t${_}", | |
"}", | |
"finally {", | |
"\t$0", | |
"}" | |
], | |
"description": "Try finally" | |
}, | |
"While loop": { | |
"prefix": "while", | |
"body": [ | |
"while (${$variable}) {", | |
"\t$0", | |
"}" | |
], | |
"description": "While loop" | |
}, | |
"Class": { | |
"prefix": "class", | |
"body": [ | |
"class ${Name} {", | |
"\t$0", | |
"}" | |
], | |
"description": "Class" | |
}, | |
"Enum": { | |
"prefix": "enum", | |
"body": [ | |
"enum ${Name} {", | |
"\t$0", | |
"}" | |
], | |
"description": "Enum" | |
}, | |
"Method": { | |
"prefix": "meth", | |
"body": [ | |
"[$1] $2() {", | |
"\t$0", | |
"}" | |
], | |
"description": "Method" | |
}, | |
"Property": { | |
"prefix": "prop", | |
"body": [ | |
"[${string}] ${$Property}$0" | |
], | |
"description": "Class property" | |
}, | |
"Property hidden": { | |
"prefix": "proph", | |
"body": [ | |
"hidden [${string}] ${$Property}$0" | |
], | |
"description": "Hidden class property" | |
}, | |
"Function": { | |
"prefix": "func", | |
"body": [ | |
"function $1() {", | |
"\t$0", | |
"}" | |
], | |
"description": "Function" | |
}, | |
"Function advanced": { | |
"prefix": "funcadv", | |
"body": [ | |
"<#", | |
".SYNOPSIS", | |
"\tShort description", | |
".DESCRIPTION", | |
"\tLong description", | |
".EXAMPLE", | |
"\tExample of how to use this cmdlet", | |
".EXAMPLE", | |
"\tAnother example of how to use this cmdlet", | |
"#>", | |
"function ${verb}-${noun} {", | |
"\t[CmdletBinding()]", | |
"\t[OutputType([${int}])]", | |
"\tparam(", | |
"\t\t[Parameter(Mandatory=$true)]", | |
"\t\t[${string}]", | |
"\t\t${Param1}", | |
"\t)", | |
"\t", | |
"\tbegin {", | |
"\t}", | |
"\t", | |
"\tprocess {", | |
"\t\t$0", | |
"\t}", | |
"\t", | |
"\tend {", | |
"\t}", | |
"}" | |
], | |
"description": "Advanced function" | |
}, | |
"Help": { | |
"prefix": "help", | |
"body": [ | |
"<#", | |
".SYNOPSIS", | |
"\tShort description", | |
".DESCRIPTION", | |
"\tLong description", | |
".PARAMETER Path", | |
"\tSpecifies a path to one or more locations.", | |
".PARAMETER LiteralPath", | |
"\tSpecifies a path to one or more locations. Unlike Path, the value of LiteralPath is used exactly as it", | |
"\tis typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose", | |
"\tit in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any", | |
"\tcharacters as escape sequences.", | |
".PARAMETER InputObject", | |
"\tSpecifies the object to be processed. You can also pipe the objects to this command.", | |
".EXAMPLE", | |
"\tC:\\PS>", | |
"\tExample of how to use this cmdlet", | |
".EXAMPLE", | |
"\tC:\\PS>", | |
"\tAnother example of how to use this cmdlet", | |
".INPUTS", | |
"\tInputs to this cmdlet (if any)", | |
".OUTPUTS", | |
"\tOutput from this cmdlet (if any)", | |
".NOTES", | |
"\tGeneral notes", | |
".COMPONENT", | |
"\tThe component this cmdlet belongs to", | |
".ROLE", | |
"\tThe role this cmdlet belongs to", | |
".FUNCTIONALITY", | |
"\tThe functionality that best describes this cmdlet", | |
"#>" | |
], | |
"description": "Help comment block" | |
} | |
"ModuleManifest": { | |
"prefix": "manifest", | |
"body": [ | |
"@{", | |
"\t# If authoring a script module, the RootModule is the name of your .psm1 file", | |
"\tRootModule = '${module:MyModule}.psm1'", | |
"", | |
"\tAuthor = '${author:Cool Person <coolperson@email.local>}'", | |
"", | |
"\tCompanyName = '${company:Contoso Inc.}'", | |
"", | |
"\tModuleVersion = '${ModuleVersion:0.1}'", | |
"", | |
"\t# Use the New-Guid command to generate a GUID, and copy/paste into the next line", | |
"\tGUID = '<pasteNewGUIDhere>'", | |
"", | |
"\tCopyright = '2017 ${company:Copyright Holder}'", | |
"", | |
"\tDescription = '${Description:What does this module do?}'", | |
"", | |
"\t# Minimum PowerShell version supported by this module (optional, recommended)", | |
"\t# PowerShellVersion = ''", | |
"", | |
"\t# Which PowerShell Editions does this module work with? (Core, Desktop)", | |
"\tCompatiblePSEditions = @('Desktop', 'Core')", | |
"", | |
"\t# Which PowerShell functions are exported from your module? (eg. Get-CoolObject)", | |
"\tFunctionsToExport = @('')", | |
"", | |
"\t# Which PowerShell aliases are exported from your module? (eg. gco)", | |
"\tAliasesToExport = @('')", | |
"", | |
"\t# Which PowerShell variables are exported from your module? (eg. Fruits, Vegetables)", | |
"\tVariablesToExport = @('')", | |
"", | |
"\t# PowerShell Gallery: Define your module's metadata", | |
"\tPrivateData = @{", | |
"\t\tPSData = @{", | |
"\t\t\t# What keywords represent your PowerShell module? (eg. cloud, tools, framework, vendor)", | |
"\t\t\tTags = @('${tag1:cooltag1}', '${tag2:cooltag2}')", | |
"", | |
"\t\t\t# What software license is your code being released under? (see https://opensource.org/licenses)", | |
"\t\t\tLicenseUri = ''", | |
"", | |
"\t\t\t# What is the URL to your project's website?", | |
"\t\t\tProjectUri = ''", | |
"", | |
"\t\t\t# What is the URI to a custom icon file for your project? (optional)", | |
"\t\t\tIconUri = ''", | |
"", | |
"\t\t\t# What new features, bug fixes, or deprecated features, are part of this release?", | |
"\t\t\tReleaseNotes = @'", | |
"'@", | |
"\t\t}", | |
"\t}", | |
"", | |
"\t# If your module supports updateable help, what is the URI to the help archive? (optional)", | |
"\t# HelpInfoURI = ''", | |
"}" | |
], | |
"description": "Basic skeleton for a PowerShell module manifest, complete with PowerShell Gallery metadata." | |
}, | |
"Example-Class": { | |
"prefix": "ex-class", | |
"body": [ | |
"class ${1:MyClass} {", | |
"\t# Property: Holds name", | |
"\t[String] \\$Name", | |
"", | |
"\t# Constructor: Creates a new MyClass object, with the specified name", | |
"\t${1:MyClass}([String] \\$NewName) {", | |
"\t\t# Set name for ${1:MyClass}", | |
"\t\t\\$this.Name = \\$NewName", | |
"\t}", | |
"", | |
"\t# Method: Method that changes \\$Name to the default name", | |
"\t[void] ChangeNameToDefault() {", | |
"\t\t\\$this.Name = \"DefaultName\"", | |
"\t}", | |
"}" | |
], | |
"description": "Example: class snippet with a constructor, property and a method" | |
}, | |
"Example-Cmdlet": { | |
"prefix": "ex-cmdlet", | |
"body": [ | |
"<#", | |
".SYNOPSIS", | |
"\tShort description", | |
".DESCRIPTION", | |
"\tLong description", | |
".EXAMPLE", | |
"\tExample of how to use this cmdlet", | |
".EXAMPLE", | |
"\tAnother example of how to use this cmdlet", | |
".INPUTS", | |
"\tInputs to this cmdlet (if any)", | |
".OUTPUTS", | |
"\tOutput from this cmdlet (if any)", | |
".NOTES", | |
"\tGeneral notes", | |
".COMPONENT", | |
"\tThe component this cmdlet belongs to", | |
".ROLE", | |
"\tThe role this cmdlet belongs to", | |
".FUNCTIONALITY", | |
"\tThe functionality that best describes this cmdlet", | |
"#>", | |
"function ${name:Verb-Noun} {", | |
"\t[CmdletBinding(DefaultParameterSetName='Parameter Set 1',", | |
"\t SupportsShouldProcess=\\$true,", | |
"\t PositionalBinding=\\$false,", | |
"\t HelpUri = 'http://www.microsoft.com/',", | |
"\t ConfirmImpact='Medium')]", | |
"\t[Alias()]", | |
"\t[OutputType([String])]", | |
"\tParam (", | |
"\t\t# Param1 help description", | |
"\t\t[Parameter(Mandatory=\\$true,", | |
"\t\t Position=0,", | |
"\t\t ValueFromPipeline=\\$true,", | |
"\t\t ValueFromPipelineByPropertyName=\\$true,", | |
"\t\t ValueFromRemainingArguments=\\$false, ", | |
"\t\t ParameterSetName='Parameter Set 1')]", | |
"\t\t[ValidateNotNull()]", | |
"\t\t[ValidateNotNullOrEmpty()]", | |
"\t\t[ValidateCount(0,5)]", | |
"\t\t[ValidateSet(\"sun\", \"moon\", \"earth\")]", | |
"\t\t[Alias(\"p1\")] ", | |
"\t\t\\$Param1,", | |
"\t\t", | |
"\t\t# Param2 help description", | |
"\t\t[Parameter(ParameterSetName='Parameter Set 1')]", | |
"\t\t[AllowNull()]", | |
"\t\t[AllowEmptyCollection()]", | |
"\t\t[AllowEmptyString()]", | |
"\t\t[ValidateScript({\\$true})]", | |
"\t\t[ValidateRange(0,5)]", | |
"\t\t[int]", | |
"\t\t\\$Param2,", | |
"\t\t", | |
"\t\t# Param3 help description", | |
"\t\t[Parameter(ParameterSetName='Another Parameter Set')]", | |
"\t\t[ValidatePattern(\"[a-z]*\")]", | |
"\t\t[ValidateLength(0,15)]", | |
"\t\t[String]", | |
"\t\t\\$Param3", | |
"\t)", | |
"\t", | |
"\tbegin {", | |
"\t}", | |
"\t", | |
"\tprocess {", | |
"\t\tif (\\$pscmdlet.ShouldProcess(\"Target\", \"Operation\")) {", | |
"\t\t\t$0", | |
"\t\t}", | |
"\t}", | |
"\t", | |
"\tend {", | |
"\t}", | |
"}" | |
], | |
"description": "Example: script cmdlet snippet with all attributes and inline help fields" | |
}, | |
"Example-DSC Configuration": { | |
"prefix": "ex-DSC config", | |
"body": [ | |
"configuration Name {", | |
"\t# One can evaluate expressions to get the node list", | |
"\t# E.g: \\$AllNodes.Where(\"Role -eq Web\").NodeName", | |
"\tnode (\"Node1\",\"Node2\",\"Node3\")", | |
"\t{", | |
"\t\t# Call Resource Provider", | |
"\t\t# E.g: WindowsFeature, File", | |
"\t\tWindowsFeature FriendlyName", | |
"\t\t{", | |
"\t\t\tEnsure = \"Present\"", | |
"\t\t\tName = \"Feature Name\"", | |
"\t\t}", | |
"", | |
"\t\tFile FriendlyName", | |
"\t\t{", | |
"\t\t\tEnsure = \"Present\"", | |
"\t\t\tSourcePath = \\$SourcePath", | |
"\t\t\tDestinationPath = \\$DestinationPath", | |
"\t\t\tType = \"Directory\"", | |
"\t\t\tDependsOn = \"[WindowsFeature]FriendlyName\"", | |
"\t\t}", | |
"\t}", | |
"}" | |
], | |
"description": "Example: DSC configuration snippet that uses built-in resource providers" | |
}, | |
"Example-DSC Resource Provider (class-based)": { | |
"prefix": "ex-DSC resource provider (class-based)", | |
"body": [ | |
"# Defines the values for the resource's Ensure property.", | |
"enum Ensure {", | |
"\t# The resource must be absent.", | |
"\tAbsent", | |
"\t# The resource must be present.", | |
"\tPresent", | |
"}", | |
"", | |
"# [DscResource()] indicates the class is a DSC resource.", | |
"[DscResource()]", | |
"class NameOfResource {", | |
"\t# A DSC resource must define at least one key property.", | |
"\t[DscProperty(Key)]", | |
"\t[string] \\$P1", | |
"\t", | |
"\t# Mandatory indicates the property is required and DSC will guarantee it is set.", | |
"\t[DscProperty(Mandatory)]", | |
"\t[Ensure] \\$P2", | |
"\t", | |
"\t# NotConfigurable properties return additional information about the state of the resource.", | |
"\t# For example, a Get() method might return the date a resource was last modified.", | |
"\t# NOTE: These properties are only used by the Get() method and cannot be set in configuration.", | |
"\t[DscProperty(NotConfigurable)]", | |
"\t[Nullable[datetime]] \\$P3", | |
"\t", | |
"\t[DscProperty()]", | |
"\t[ValidateSet(\"val1\", \"val2\")]", | |
"\t[string] \\$P4", | |
"\t", | |
"\t# Gets the resource's current state.", | |
"\t[NameOfResource] Get() {", | |
"\t\t# NotConfigurable properties are set in the Get method.", | |
"\t\t\\$this.P3 = something", | |
"\t\t# Return this instance or construct a new instance.", | |
"\t\treturn \\$this", | |
"\t}", | |
"\t", | |
"\t# Sets the desired state of the resource.", | |
"\t[void] Set() {", | |
"\t}", | |
"\t", | |
"\t# Tests if the resource is in the desired state.", | |
"\t[bool] Test() {", | |
"\t\t return \\$true", | |
"\t}", | |
"}" | |
], | |
"description": "Example: class-based DSC resource provider snippet" | |
}, | |
"Example-DSC Resource Provider (function based)": { | |
"prefix": "ex-DSC resource provider (function based)", | |
"body": [ | |
"function Get-TargetResource {", | |
"\t# TODO: Add parameters here", | |
"\t# Make sure to use the same parameters for", | |
"\t# Get-TargetResource, Set-TargetResource, and Test-TargetResource", | |
"\tparam (", | |
"\t)", | |
"}", | |
"function Set-TargetResource {", | |
"\t# TODO: Add parameters here", | |
"\t# Make sure to use the same parameters for", | |
"\t# Get-TargetResource, Set-TargetResource, and Test-TargetResource", | |
"\tparam (", | |
"\t)", | |
"}", | |
"function Test-TargetResource {", | |
"\t# TODO: Add parameters here", | |
"\t# Make sure to use the same parameters for", | |
"\t# Get-TargetResource, Set-TargetResource, and Test-TargetResource", | |
"\tparam (", | |
"\t)", | |
"}" | |
], | |
"description": "Example: function-based DSC resource provider snippet" | |
}, | |
"Example-Path Processing for Non-Existing Paths": { | |
"prefix": "ex-path processing for non-existing paths", | |
"body": [ | |
"# Modify [CmdletBinding()] to [CmdletBinding(SupportsShouldProcess=\\$true)]", | |
"\\$paths = @()", | |
"foreach (\\$aPath in \\$Path) {", | |
"\t# Resolve any relative paths", | |
"\t\\$paths += \\$psCmdlet.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\\$aPath)", | |
"}", | |
"", | |
"foreach (\\$aPath in \\$paths) {", | |
"\tif (\\$pscmdlet.ShouldProcess(\\$aPath, 'Operation')) {", | |
"\t\t# Process each path", | |
"\t\t$0", | |
"\t}", | |
"}" | |
], | |
"description": "Example: processing non-existing paths typically used in New-* commands (for use in process block). See parameter-path snippet." | |
}, | |
"Example-Path Processing for No Wildcards Allowed": { | |
"prefix": "ex-path processing for no wildcards allowed", | |
"body": [ | |
"# Modify [CmdletBinding()] to [CmdletBinding(SupportsShouldProcess=\\$true)]", | |
"\\$paths = @()", | |
"foreach (\\$aPath in \\$Path) {", | |
"\tif (!(Test-Path -LiteralPath \\$aPath)) {", | |
"\t\t\\$ex = New-Object System.Management.Automation.ItemNotFoundException \"Cannot find path '\\$aPath' because it does not exist.\"", | |
"\t\t\\$category = [System.Management.Automation.ErrorCategory]::ObjectNotFound", | |
"\t\t\\$errRecord = New-Object System.Management.Automation.ErrorRecord \\$ex,'PathNotFound',\\$category,\\$aPath", | |
"\t\t\\$psCmdlet.WriteError(\\$errRecord)", | |
"\t\tcontinue", | |
"\t}", | |
"", | |
"\t# Resolve any relative paths", | |
"\t\\$paths += \\$psCmdlet.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\\$aPath)", | |
"}", | |
"", | |
"foreach (\\$aPath in \\$paths) {", | |
"\tif (\\$pscmdlet.ShouldProcess(\\$aPath, 'Operation')) {", | |
"\t\t# Process each path", | |
"\t\t$0", | |
"\t}", | |
"}" | |
], | |
"description": "Example: processing non-wildcard paths that must exist (for use in process block). See parameter-path snippets." | |
}, | |
"Example-Path Processing for Wildcards Allowed": { | |
"prefix": "ex-path processing for wildcards allowed", | |
"body": [ | |
"# Modify [CmdletBinding()] to [CmdletBinding(SupportsShouldProcess=\\$true, DefaultParameterSetName='Path')]", | |
"\\$paths = @()", | |
"if (\\$psCmdlet.ParameterSetName -eq 'Path') {", | |
"\tforeach (\\$aPath in \\$Path) {", | |
"\t\tif (!(Test-Path -Path \\$aPath)) {", | |
"\t\t\t\\$ex = New-Object System.Management.Automation.ItemNotFoundException \"Cannot find path '\\$aPath' because it does not exist.\"", | |
"\t\t\t\\$category = [System.Management.Automation.ErrorCategory]::ObjectNotFound", | |
"\t\t\t\\$errRecord = New-Object System.Management.Automation.ErrorRecord \\$ex,'PathNotFound',\\$category,\\$aPath", | |
"\t\t\t\\$psCmdlet.WriteError(\\$errRecord)", | |
"\t\t\tcontinue", | |
"\t\t}", | |
"\t", | |
"\t\t# Resolve any wildcards that might be in the path", | |
"\t\t\\$provider = \\$null", | |
"\t\t\\$paths += \\$psCmdlet.SessionState.Path.GetResolvedProviderPathFromPSPath(\\$aPath, [ref]\\$provider)", | |
"\t}", | |
"}", | |
"else {", | |
"\tforeach (\\$aPath in \\$LiteralPath) {", | |
"\t\tif (!(Test-Path -LiteralPath \\$aPath)) {", | |
"\t\t\t\\$ex = New-Object System.Management.Automation.ItemNotFoundException \"Cannot find path '\\$aPath' because it does not exist.\"", | |
"\t\t\t\\$category = [System.Management.Automation.ErrorCategory]::ObjectNotFound", | |
"\t\t\t\\$errRecord = New-Object System.Management.Automation.ErrorRecord \\$ex,'PathNotFound',\\$category,\\$aPath", | |
"\t\t\t\\$psCmdlet.WriteError(\\$errRecord)", | |
"\t\t\tcontinue", | |
"\t\t}", | |
"\t", | |
"\t\t# Resolve any relative paths", | |
"\t\t\\$paths += \\$psCmdlet.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\\$aPath)", | |
"\t}", | |
"}", | |
"", | |
"foreach (\\$aPath in \\$paths) {", | |
"\tif (\\$pscmdlet.ShouldProcess(\\$aPath, 'Operation')) {", | |
"\t\t# Process each path", | |
"\t\t$0", | |
"\t}", | |
"}" | |
], | |
"description": "Example: processing wildcard paths that must exist (for use in process block). See parameter-path-wildcards and parameter-literalpath snippets." | |
}, | |
"Example-Splatting": { | |
"prefix": "ex-splat", | |
"body": [ | |
"\\$Params = @{", | |
"\tModule = '*'", | |
"\tVerb = 'Get'", | |
"}", | |
"Get-Command @Params" | |
], | |
"description": "Example: PowerShell splatting technique snippet" | |
}, | |
"Example-Switch": { | |
"prefix": "ex-switch", | |
"body": [ | |
"switch (${variable:\\$x})", | |
"{", | |
"\t'${val:value1}' { $1 }", | |
"\t{\\$_ -in 'A','B','C'} {}", | |
"\t'value3' {}", | |
"\tDefault {}", | |
"}" | |
], | |
"description": "Example: switch statement snippet" | |
}, | |
"Example-Advanced Workflow": { | |
"prefix": "ex-advanced workflow", | |
"body": [ | |
"<#", | |
".Synopsis", | |
"\tShort description", | |
".DESCRIPTION", | |
"\tLong description", | |
".EXAMPLE", | |
"\tExample of how to use this workflow", | |
".EXAMPLE", | |
"\tAnother example of how to use this workflow", | |
".INPUTS", | |
"\tInputs to this workflow (if any)", | |
".OUTPUTS", | |
"\tOutput from this workflow (if any)", | |
".NOTES", | |
"\tGeneral notes", | |
".FUNCTIONALITY", | |
"\tThe functionality that best describes this workflow", | |
"#>", | |
"workflow ${name:Verb-Noun} {", | |
"\t[CmdletBinding(DefaultParameterSetName='Parameter Set 1',", | |
"\t HelpUri = 'http://www.microsoft.com/',", | |
"\t ConfirmImpact='Medium')]", | |
"\t[Alias()]", | |
"\t[OutputType([String])]", | |
"\tparam (", | |
"\t\t# Param1 help description", | |
"\t\t[Parameter(Mandatory=\\$true, ", | |
"\t\t Position=0,", | |
"\t\t ParameterSetName='Parameter Set 1')]", | |
"\t\t[ValidateNotNull()]", | |
"\t\t[Alias(\"p1\")] ", | |
"\t\t\\$Param1,", | |
"", | |
"\t\t# Param2 help description", | |
"\t\t[int]", | |
"\t\t\\$Param2", | |
"\t)", | |
"", | |
"\t# Saves (persists) the current workflow state and output", | |
"\t# Checkpoint-Workflow", | |
"\t# Suspends the workflow", | |
"\t# Suspend-Workflow", | |
"", | |
"\t# Workflow common parameters are available as variables such as:", | |
"\t\\$PSPersist ", | |
"\t\\$PSComputerName", | |
"\t\\$PSCredential", | |
"\t\\$PSUseSsl", | |
"\t\\$PSAuthentication", | |
"", | |
"\t# Workflow runtime information can be accessed by using the following variables:", | |
"\t\\$Input", | |
"\t\\$PSSenderInfo", | |
"\t\\$PSWorkflowRoot", | |
"\t\\$JobCommandName", | |
"\t\\$ParentCommandName", | |
"\t\\$JobId", | |
"\t\\$ParentJobId", | |
"\t\\$WorkflowInstanceId", | |
"\t\\$JobInstanceId", | |
"\t\\$ParentJobInstanceId", | |
"\t\\$JobName", | |
"\t\\$ParentJobName", | |
"", | |
"\t# Set the progress message ParentActivityId", | |
"\t\\$PSParentActivityId", | |
"", | |
"\t# Preference variables that control runtime behavior", | |
"\t\\$PSRunInProcessPreference", | |
"\t\\$PSPersistPreference", | |
"}" | |
], | |
"description": "Example: advanced workflow snippet" | |
}, | |
"Class": { | |
"prefix": "class", | |
"body": [ | |
"class ${1:ClassName} {", | |
"\t$0", | |
"}" | |
], | |
"description": "Class definition snippet" | |
}, | |
"Constructor": { | |
"prefix": "ctor", | |
"body": [ | |
"${1:ClassName}(${2:OptionalParameters}) {", | |
"\t$0", | |
"}" | |
], | |
"description": "Class constructor definition snippet" | |
}, | |
"Hidden Property": { | |
"prefix": "proph", | |
"body": [ | |
"hidden [${1:string}] $${0:PropertyName}" | |
], | |
"description": "Class hidden property definition snippet" | |
}, | |
"Property": { | |
"prefix": "prop", | |
"body": [ | |
"[${1:string}] $${0:PropertyName}" | |
], | |
"description": "Class property definition snippet" | |
}, | |
"Method": { | |
"prefix": "method", | |
"body": [ | |
"[${1:void}] ${2:MethodName}($${3:OptionalParameters}) {", | |
"\t$0", | |
"}" | |
], | |
"description": "Class method definition snippet" | |
}, | |
"Enum": { | |
"prefix": "enum", | |
"body": [ | |
"enum ${1:EnumName} {", | |
"\t$0", | |
"}" | |
], | |
"description": "Enum definition snippet" | |
}, | |
"Cmdlet": { | |
"prefix": "cmdlet", | |
"body": [ | |
"function ${1:Verb-Noun} {", | |
"\t[CmdletBinding()]", | |
"\tparam (", | |
"\t\t$0", | |
"\t)", | |
"\t", | |
"\tbegin {", | |
"\t}", | |
"\t", | |
"\tprocess {", | |
"\t}", | |
"\t", | |
"\tend {", | |
"\t}", | |
"}" | |
], | |
"description": "Script cmdlet definition snippet" | |
}, | |
"Function-Advanced": { | |
"prefix": "function-advanced", | |
"body": [ | |
"function ${1:Verb-Noun} {", | |
"\t[CmdletBinding()]", | |
"\tparam (", | |
"\t\t$0", | |
"\t)", | |
"\t", | |
"\tbegin {", | |
"\t}", | |
"\t", | |
"\tprocess {", | |
"\t}", | |
"\t", | |
"\tend {", | |
"\t}", | |
"}" | |
], | |
"description": "Script advanced function definition snippet" | |
}, | |
"Cmdlet-Comment-Help": { | |
"prefix": "comment-help", | |
"body": [ | |
"<#", | |
".SYNOPSIS", | |
"\tShort description", | |
".DESCRIPTION", | |
"\tLong description", | |
".EXAMPLE", | |
"\tPS C:\\> <example usage>", | |
"\tExplanation of what the example does", | |
".INPUTS", | |
"\tInputs (if any)", | |
".OUTPUTS", | |
"\tOutput (if any)", | |
".NOTES", | |
"\tGeneral notes", | |
"#>" | |
], | |
"description": "Comment-based help snippet" | |
}, | |
"Parameter": { | |
"prefix": "parameter", | |
"body": [ | |
"# ${1:Parameter help description}", | |
"[Parameter(${2:AttributeValues})]", | |
"[${3:ParameterType}]", | |
"$${0:ParameterName}" | |
], | |
"description": "Parameter declaration snippet" | |
}, | |
"Parameter-Path": { | |
"prefix": "parameter-path", | |
"body": [ | |
"# Specifies a path to one or more locations.", | |
"[Parameter(Mandatory=\\$true,", | |
" Position=${1:0},", | |
" ParameterSetName=\"${2:ParameterSetName}\",", | |
" ValueFromPipeline=\\$true,", | |
" ValueFromPipelineByPropertyName=\\$true,", | |
" HelpMessage=\"Path to one or more locations.\")]", | |
"[Alias(\"PSPath\")]", | |
"[ValidateNotNullOrEmpty()]", | |
"[string[]]", | |
"$${3:ParameterName}$0" | |
], | |
"description": "Parameter declaration snippet for Path parameter that does not accept wildcards. Do not use with parameter-literalpath." | |
}, | |
"Parameter-Path-Wildcards": { | |
"prefix": "parameter-path-wildcards", | |
"body": [ | |
"# Specifies a path to one or more locations. Wildcards are permitted.", | |
"[Parameter(Mandatory=\\$true,", | |
" Position=${1:Position},", | |
" ParameterSetName=\"${2:ParameterSetName}\",", | |
" ValueFromPipeline=\\$true,", | |
" ValueFromPipelineByPropertyName=\\$true,", | |
" HelpMessage=\"Path to one or more locations.\")]", | |
"[ValidateNotNullOrEmpty()]", | |
"[SupportsWildcards()]", | |
"[string[]]", | |
"$${3:ParameterName}$0" | |
], | |
"description": "Parameter declaration snippet for Path parameter that accepts wildcards. Add parameter-literalpath to handle paths with embedded wildcard chars." | |
}, | |
"Parameter-LiteralPath": { | |
"prefix": "parameter-literalpath", | |
"body": [ | |
"# Specifies a path to one or more locations. Unlike the Path parameter, the value of the LiteralPath parameter is", | |
"# used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters,", | |
"# enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any", | |
"# characters as escape sequences.", | |
"[Parameter(Mandatory=\\$true,", | |
" Position=${1:0},", | |
" ParameterSetName=\"${2:LiteralPath}\",", | |
" ValueFromPipelineByPropertyName=\\$true,", | |
" HelpMessage=\"Literal path to one or more locations.\")]", | |
"[Alias(\"PSPath\")]", | |
"[ValidateNotNullOrEmpty()]", | |
"[string[]]", | |
"$${2:LiteralPath}$0" | |
], | |
"description": "Parameter declaration snippet for a LiteralPath parameter" | |
}, | |
"DSC Ensure Enum": { | |
"prefix": "DSC Ensure enum", | |
"body": [ | |
"enum Ensure {", | |
"\tAbsent", | |
"\tPresent", | |
"}" | |
], | |
"description": "DSC Ensure enum definition snippet" | |
}, | |
"DSC Resource Provider (class-based)": { | |
"prefix": "DSC resource provider (class-based)", | |
"body": [ | |
"[DscResource()]", | |
"class ${ResourceName:NameOfResource} {", | |
"\t[DscProperty(Key)]", | |
"\t[string] $${PropertyName:KeyName}", | |
"\t", | |
"\t# Gets the resource's current state.", | |
"\t[${ResourceName:NameOfResource}] Get() {", | |
"\t\t$0", | |
"\t\treturn \\$this", | |
"\t}", | |
"\t", | |
"\t# Sets the desired state of the resource.", | |
"\t[void] Set() {", | |
"\t\t", | |
"\t}", | |
"\t", | |
"\t# Tests if the resource is in the desired state.", | |
"\t[bool] Test() {", | |
"\t\t", | |
"\t}", | |
"}" | |
], | |
"description": "Class-based DSC resource provider snippet" | |
}, | |
"DSC Resource Provider (function-based)": { | |
"prefix": "DSC resource provider (function-based)", | |
"body": [ | |
"function Get-TargetResource {", | |
"\tparam (", | |
"\t)", | |
"\t", | |
"\t$0", | |
"}", | |
"function Set-TargetResource {", | |
"\tparam (", | |
"\t)", | |
"\t", | |
"}", | |
"function Test-TargetResource {", | |
"\tparam (", | |
"\t)", | |
"\t", | |
"}" | |
], | |
"description": "Function-based DSC resource provider snippet" | |
}, | |
"comment block": { | |
"prefix": "comment", | |
"body": [ | |
"<#", | |
" # $0", | |
" #>" | |
], | |
"description": "Comment block snippet" | |
}, | |
"do-until": { | |
"prefix": "do-until", | |
"body": [ | |
"do {", | |
"\t$0", | |
"} until (${1:condition})" | |
], | |
"description": "do-until loop snippet" | |
}, | |
"do-while": { | |
"prefix": "do-while", | |
"body": [ | |
"do {", | |
"\t$0", | |
"} while (${1:condition})" | |
], | |
"description": "do-while loop snippet" | |
}, | |
"while": { | |
"prefix": "while", | |
"body": [ | |
"while (${1:condition}) {", | |
"\t$0", | |
"}" | |
], | |
"description": "while loop snippet" | |
}, | |
"for": { | |
"prefix": "for", | |
"body": [ | |
"for ($${1:i} = 0; $${1:i} -lt $${2:array}.Count; $${1:i}++) {", | |
"\t$0", | |
"}" | |
], | |
"description": "for loop snippet" | |
}, | |
"for-reversed": { | |
"prefix": "forr", | |
"body": [ | |
"for ($${1:i} = $${2:array}.Count - 1; $${1:i} -ge 0 ; $${1:i}--) {", | |
"\t$0", | |
"}" | |
], | |
"description": "reversed for loop snippet" | |
}, | |
"foreach": { | |
"prefix": "foreach", | |
"body": [ | |
"foreach ($${1:item} in $${2:collection}) {", | |
"\t$0", | |
"}" | |
], | |
"description": "foreach loop snippet" | |
}, | |
"function": { | |
"prefix": "function", | |
"body": [ | |
"function ${1:FunctionName} {", | |
"\tparam (", | |
"\t\t${2:OptionalParameters}", | |
"\t)", | |
"\t$0", | |
"}" | |
], | |
"description": "Function definition snippet that contains a param block" | |
}, | |
"Function-Inline": { | |
"prefix": "Function-Inline", | |
"body": [ | |
"function ${1:FunctionName} (${2:OptionalParameters}) {", | |
"\t$0", | |
"}" | |
], | |
"description": "Function definition snippet that does not contain a param block, but defines parameters inline. This syntax is commonly used in other lanaguages" | |
}, | |
"if": { | |
"prefix": "if", | |
"body": [ | |
"if (${1:condition}) {", | |
"\t$0", | |
"}" | |
], | |
"description": "if statement snippet" | |
}, | |
"elseif": { | |
"prefix": "elseif", | |
"body": [ | |
"elseif (${1:condition}) {", | |
"\t$0", | |
"}" | |
], | |
"description": "elseif statement snippet" | |
}, | |
"else": { | |
"prefix": "else", | |
"body": [ | |
"else {", | |
"\t$0", | |
"}" | |
], | |
"description": "else statement snippet" | |
}, | |
"switch": { | |
"prefix": "switch", | |
"body": [ | |
"switch (${1:\\$x}) {", | |
"\t${2:condition} { $0 }", | |
"\tDefault {}", | |
"}" | |
], | |
"description": "switch statement snippet" | |
}, | |
"try-catch": { | |
"prefix": "try", | |
"body": [ | |
"try {", | |
"\t$0", | |
"}", | |
"catch {", | |
"\t", | |
"}" | |
], | |
"description": "try-catch snippet" | |
}, | |
"try-catch-finally": { | |
"prefix": "trycf", | |
"body": [ | |
"try {", | |
"\t$0", | |
"}", | |
"catch {", | |
"\t", | |
"}", | |
"finally {", | |
"\t", | |
"}" | |
], | |
"description": "try-catch-finally snippet" | |
}, | |
"try-finally": { | |
"prefix": "tryf", | |
"body": [ | |
"try {", | |
"\t$0", | |
"}", | |
"finally {", | |
"\t", | |
"}" | |
], | |
"description": "try-finally snippet" | |
}, | |
"Workflow": { | |
"prefix": "workflow", | |
"body": [ | |
"workflow ${name:Verb-Noun} {", | |
"\tparam (", | |
"\t)", | |
"", | |
"\t$0", | |
"}" | |
], | |
"description": "workflow snippet" | |
}, | |
"Workflow ForEachParallel": { | |
"prefix": "workflow foreach-parallel", | |
"body": [ | |
"foreach -parallel ($${variable:item} in $${collection:collection}) {", | |
"\t$0", | |
"}" | |
], | |
"description": "foreach-parallel snippet (for use inside a workflow)" | |
}, | |
"Workflow InlineScript": { | |
"prefix": "workflow inlinescript", | |
"body": [ | |
"inlineScript {", | |
"\t$0", | |
"}" | |
], | |
"description": "inlinescript snippet (for use inside a workflow)" | |
}, | |
"Workflow Parallel": { | |
"prefix": "workflow parallel", | |
"body": [ | |
"parallel {", | |
"\t$0", | |
"}" | |
], | |
"description": "parallel snippet (for use inside a workflow)" | |
}, | |
"Workflow Sequence": { | |
"prefix": "workflow sequence", | |
"body": [ | |
"sequence {", | |
"\t$0", | |
"}" | |
], | |
"description": "sequence snippet (for use inside a workflow)" | |
}, | |
"Suppress PSScriptAnalyzer Rule": { | |
"prefix": "suppress-message-rule", | |
"description": "Suppress a built-in PSScriptAnalyzer rule using the SuppressMessageAttribute", | |
"body": [ | |
"[Diagnostics.CodeAnalysis.SuppressMessageAttribute('${1:PSUseDeclaredVarsMoreThanAssignments}', '')]" | |
] | |
}, | |
"Suppress PSScriptAnalyzer Rule on Parameter": { | |
"prefix": "suppress-message-rule-for-parameter", | |
"description": "Suppress a built-in PSScriptAnalyzer rule on a parameter using the SuppressMessageAttribute", | |
"body": [ | |
"[Diagnostics.CodeAnalysis.SuppressMessageAttribute('${1:PSUseDeclaredVarsMoreThanAssignments}', '${2:ParamName}')]" | |
] | |
}, | |
"Suppress PSScriptAnalyzer Rule in Scope": { | |
"prefix": "suppress-message-rule-for-scope", | |
"description": "Suppress a built-in PSScriptAnalyzer rule for functions or classes in a specific scope using the SuppressMessageAttribute", | |
"body": [ | |
"[Diagnostics.CodeAnalysis.SuppressMessageAttribute('${1:PSProvideDefaultParameterValue}', '', Scope='Function', Target='${2:*}')]" | |
] | |
}, | |
"PSCustomObject": { | |
"prefix": "PSCustomObject", | |
"body": [ | |
"[PSCustomObject]@{", | |
"\t${1:Name} = ${2:Value}", | |
"}" | |
], | |
"description": "Creates a PSCustomObject" | |
}, | |
"Hashtable": { | |
"prefix": "Hashtable", | |
"body": [ | |
"\\$${1:Var} = @{", | |
"\t${2:Name} = ${3:Value}", | |
"}" | |
], | |
"description": "Creates a Hashtable" | |
}, | |
"Region Block": { | |
"prefix": "#region", | |
"body": [ | |
"#region ${1}", | |
"$0", | |
"#endregion" | |
], | |
"description": "Region Block for organizing and folding of your code" | |
}, | |
"IfShouldProcess": { | |
"prefix": "IfShouldProcess", | |
"body": [ | |
"if (\\$PSCmdlet.ShouldProcess(\"${1:Target}\", \"${2:Operation}\")) {", | |
"\t$0", | |
"}" | |
], | |
"description": "Creates ShouldProcess block" | |
}, | |
"CalculatedProperty": { | |
"prefix": "Calculated-Property", | |
"body": [ | |
"@{name='${1:PropertyName}';expression={${2:\\$_.PropertyValue}}}$0" | |
], | |
"description": "Creates a Calculated Property typically used with Select-Object." | |
}, | |
"PesterDescribeContextIt": { | |
"prefix": "Describe-Context-It-Pester", | |
"body": [ | |
"Describe \"${1:DescribeName}\" {", | |
"\tContext \"${2:ContextName}\" {", | |
"\t\tIt \"${3:ItName}\" {", | |
"\t\t\t${4:Assertion}", | |
"\t\t}$0", | |
"\t}", | |
"}" | |
], | |
"description": "Pester Describe block with nested Context & It blocks" | |
}, | |
"PesterDescribeBlock": { | |
"prefix": "Describe-Pester", | |
"body": [ | |
"Describe \"${1:DescribeName}\" {", | |
"\t$0", | |
"}" | |
], | |
"description": "Pester Describe block" | |
}, | |
"PesterContextIt": { | |
"prefix": "Context-It-Pester", | |
"body": [ | |
"Context \"${1:ContextName}\" {", | |
"\tIt \"${2:ItName}\" {", | |
"\t\t${3:Assertion}", | |
"\t}$0", | |
"}" | |
], | |
"description": "Pester - Context block with nested It block" | |
}, | |
"PesterContext": { | |
"prefix": "Context-Pester", | |
"body": [ | |
"Context \"${1:ContextName}\" {", | |
"\t$0", | |
"}" | |
], | |
"description": "Pester - Context block" | |
}, | |
"PesterIt": { | |
"prefix": "It-Pester", | |
"body": [ | |
"It \"${1:ItName}\" {", | |
"\t${2:Assertion}", | |
"}$0" | |
], | |
"description": "Pester - It block" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment