Created
November 1, 2022 17:37
-
-
Save HurtzDonut/7c58366209c037c3ebaf31654a84c60d to your computer and use it in GitHub Desktop.
VSCode User Snippet - PowerShell
This file contains hidden or 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
Show hidden 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" | |
// } | |
"Formatted Function": { | |
"prefix": "my_function_formatted", | |
"body":[ | |
"<#", | |
".SYNOPSIS", | |
"\tShort Description of Function", | |
".PARAMETER ${4:Param1}", | |
"\tDescription for $${4:Param1}", | |
".EXAMPLE", | |
"\tPS C:\\> ${2:Verb-Noun} -${4:Param1}", | |
"\r", | |
"\tShort explanation for example", | |
".INPUTS", | |
"\t${3:DataType}", | |
".OUTPUTS", | |
"\r", | |
".NOTES", | |
"\tAuthor\t\t${1:Full Name}", | |
"\tCreated\t\t$CURRENT_MONTH-$CURRENT_DATE-$CURRENT_YEAR", | |
"\tModified\t$CURRENT_MONTH-$CURRENT_DATE-$CURRENT_YEAR", | |
"\tVersion\t\t1.0", | |
"#>", | |
"Function ${2:Verb-Noun} {", | |
"\t[CmdLetBinding()]", | |
"\tParam (", | |
"\t\t[Parameter()]", | |
"\t\t\t[${3:DataType}]$${4:Param1}", | |
"\t)", | |
"\tBegin {", | |
"\t\t$0", | |
"\t} # Begin", | |
"\tProcess {", | |
"\t\t", | |
"\t} # Process", | |
"\tEnd {", | |
"\t\t", | |
"\t} # End", | |
"} # Function ${2:Verb-Noun}" | |
], | |
"description": "Custom PS Function Snippet" | |
}, | |
"Formatted Function - Selection": { | |
"prefix": "my_function_selection", | |
"body":[ | |
"<#", | |
".SYNOPSIS", | |
"\tShort Description of Function", | |
".PARAMETER ${6:Param1}", | |
"\tDescription for $${6:Param1}", | |
".EXAMPLE", | |
"\tPS C:\\> ${TM_SELECTED_TEXT/^([a-z]*)(-)([a-z]+)$/${1:/capitalize}$2${3:/capitalize}/} -${4:Param1}", | |
"\r", | |
"\tShort explanation for example", | |
".INPUTS", | |
"\t${5:DataType}", | |
".OUTPUTS", | |
"\r", | |
".NOTES", | |
"\tAuthor\t\t${4:Full Name}", | |
"\tCreated\t\t$CURRENT_MONTH-$CURRENT_DATE-$CURRENT_YEAR", | |
"\tModified\t$CURRENT_MONTH-$CURRENT_DATE-$CURRENT_YEAR", | |
"\tVersion\t\t1.0", | |
"#>", | |
"Function ${TM_SELECTED_TEXT/^([a-z]*)(-)([a-z]+)$/${1:/capitalize}$2${3:/capitalize}/} {", | |
"\t[CmdLetBinding()]", | |
"\tParam (", | |
"\t\t[Parameter()]", | |
"\t\t\t[${5:DataType}]$${6:Param1}", | |
"\t)", | |
"\tBegin {", | |
"\t\t$0", | |
"\t} # Begin", | |
"\tProcess {", | |
"\t\t", | |
"\t} # Process", | |
"\tEnd {", | |
"\t\t", | |
"\t} # End", | |
"} # Function ${TM_SELECTED_TEXT/^([a-z]*)(-)([a-z]+)$/${1:/capitalize}$2${3:/capitalize}/}" | |
], | |
"description": "Custom PS Function Snippet" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment