|
240 | 240 | ]
|
241 | 241 | },
|
242 | 242 | "Function-Advanced-Doc-Full-Example-From-ISE": {
|
243 |
| - "prefix": ["function-advanced-doc-fromISE", "cmdlet-doc-fromISE"], |
| 243 | + "prefix": [ |
| 244 | + "function-advanced-doc-fromISE", |
| 245 | + "cmdlet-doc-fromISE" |
| 246 | + ], |
244 | 247 | "description": "Script advanced function definition with full comment-based help and parameter attributes.",
|
245 | 248 | "body": [
|
246 | 249 | "function ${1:Verb-Noun} {",
|
247 | 250 | "\t<#",
|
248 | 251 | "\t.SYNOPSIS",
|
249 |
| - "\tShort description", |
| 252 | + "\t${2:Short description}", |
250 | 253 | "\t.DESCRIPTION",
|
251 |
| - "\tLong description", |
| 254 | + "\t${3:Long description}", |
252 | 255 | "\t.EXAMPLE",
|
253 |
| - "\tExample of how to use this cmdlet", |
| 256 | + "\t${4:Example of how to use this cmdlet}", |
254 | 257 | "\t.EXAMPLE",
|
255 |
| - "\tAnother example of how to use this cmdlet", |
| 258 | + "\t${5:Another example of how to use this cmdlet}", |
256 | 259 | "\t.INPUTS",
|
257 |
| - "\tInputs to this cmdlet (if any)", |
| 260 | + "\t${6:Inputs to this cmdlet (if any)}", |
258 | 261 | "\t.OUTPUTS",
|
259 |
| - "\tOutput from this cmdlet (if any)", |
| 262 | + "\t${7:Output from this cmdlet (if any)}", |
260 | 263 | "\t.NOTES",
|
261 |
| - "\tGeneral notes", |
| 264 | + "\t${8:General notes}", |
262 | 265 | "\t.COMPONENT",
|
263 |
| - "\tThe component this cmdlet belongs to", |
| 266 | + "\t${9:The component this cmdlet belongs to}", |
264 | 267 | "\t.ROLE",
|
265 |
| - "\tThe role this cmdlet belongs to", |
| 268 | + "\t${10:The role this cmdlet belongs to}", |
266 | 269 | "\t.FUNCTIONALITY",
|
267 |
| - "\tThe functionality that best describes this cmdlet", |
| 270 | + "\t${11:The functionality that best describes this cmdlet}", |
268 | 271 | "\t#>",
|
269 |
| - "\t[CmdletBinding(DefaultParameterSetName = 'Parameter Set 1',", |
| 272 | + "\t[CmdletBinding(DefaultParameterSetName = '${12:ParameterSet1}',", |
270 | 273 | "\t\tSupportsShouldProcess,",
|
271 |
| - "\t\tPositionalBinding", |
272 |
| - "\t\tHelpUri = 'http://yourwebsiteforhelp.here',", |
| 274 | + "\t\tPositionalBinding,", |
| 275 | + "\t\tHelpUri = '${13:http://yourwebsiteforhelp.here}',", |
273 | 276 | "\t\tConfirmImpact = 'Medium')]",
|
274 |
| - "\t[Alias('Be-lazyWithThis','lzy','Use-OldFunctionName')]", |
275 |
| - "\t[OutputType([String])]", |
| 277 | + "\t[Alias('${14:Be-lazyWithThis}','${15:lzy}','${16:Use-OldFunctionName}')]", |
| 278 | + "\t[OutputType([${17:String}])]", |
276 | 279 | "\tparam (",
|
277 |
| - "\t\t# Param1 help description", |
| 280 | + "\t\t# ${18:Param1} help description", |
278 | 281 | "\t\t[Parameter(Mandatory,",
|
279 | 282 | "\t\t\tValueFromPipeline,",
|
280 | 283 | "\t\t\tValueFromPipelineByPropertyName,",
|
281 | 284 | "\t\t\tValueFromRemainingArguments,",
|
282 | 285 | "\t\t\tPosition = 0,",
|
283 |
| - "\t\t\tParameterSetName = 'Parameter Set 1')]", |
| 286 | + "\t\t\tParameterSetName = '${12:ParameterSet1}')]", |
284 | 287 | "\t\t[ValidateNotNull()]",
|
285 | 288 | "\t\t[ValidateNotNullOrEmpty()]",
|
286 | 289 | "\t\t[ValidateCount(0, 5)]",
|
287 |
| - "\t\t[ValidateSet(\"sun\", \"moon\", \"earth\")]", |
288 |
| - "\t\t[Alias(\"p1\")]", |
289 |
| - "\t\t\\$Param1,", |
| 290 | + "\t\t[ValidateSet(\"${19:sun}\", \"${20:moon}\", \"${21:earth}\")]", |
| 291 | + "\t\t[Alias(\"${22:p1}\")]", |
| 292 | + "\t\t$${18:Param1},", |
290 | 293 | "",
|
291 |
| - "\t\t# Param2 help description", |
292 |
| - "\t\t[Parameter(ParameterSetName = 'Parameter Set 1')]", |
| 294 | + "\t\t# ${24:Param2} help description", |
| 295 | + "\t\t[Parameter(ParameterSetName = '${12:ParameterSet1}')]", |
293 | 296 | "\t\t[AllowNull()]",
|
294 | 297 | "\t\t[AllowEmptyCollection()]",
|
295 | 298 | "\t\t[AllowEmptyString()]",
|
296 |
| - "\t\t[ValidateScript({ \\$true })]", |
| 299 | + "\t\t[ValidateScript({ ${25:true} })]", |
297 | 300 | "\t\t[ValidateRange(0, 5)]",
|
298 |
| - "\t\t[int]", |
299 |
| - "\t\t\\$Param2,", |
| 301 | + "\t\t[${26:int}]", |
| 302 | + "\t\t$${24:Param2},", |
300 | 303 | "",
|
301 |
| - "\t\t# Param3 help description", |
302 |
| - "\t\t[Parameter(ParameterSetName = 'Another Parameter Set')]", |
303 |
| - "\t\t[ValidatePattern(\"[a-z]*\")]", |
| 304 | + "\t\t# ${28:Param3} help description", |
| 305 | + "\t\t[Parameter(ParameterSetName = '${29:Another Parameter Set}')]", |
| 306 | + "\t\t[ValidatePattern(\"${30:[a-z]*}\")]", |
304 | 307 | "\t\t[ValidateLength(0, 15)]",
|
305 |
| - "\t\t[String]", |
306 |
| - "\t\t\\$Param3", |
| 308 | + "\t\t[${31:String}]", |
| 309 | + "\t\t$${28:Param3},", |
307 | 310 | "",
|
| 311 | + "\t\t# ${33:Param4} help description", |
308 | 312 | "\t\t# Checkout the docs https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions_argument_completion?view=powershell-7.5#argumentcompletions-attribute on different ways to provide Argument Completion",
|
309 |
| - "\t\t[Parameter(ParameterSetName = 'Yet Another Parameter Set')]", |
310 |
| - "\t\t[ArgumentCompleter({'add completer script'})]", |
| 313 | + "\t\t[Parameter(ParameterSetName = '${34:Yet Another Parameter Set}')]", |
| 314 | + "\t\t[ArgumentCompleter({'${35:add completer script}'})]", |
311 | 315 | "\t\t[ValidateLength(0, 15)]",
|
312 |
| - "\t\t[String]", |
313 |
| - "\t\t\\$Param4", |
| 316 | + "\t\t[${36:String}]", |
| 317 | + "\t\t$${33:Param4}", |
314 | 318 | "\t)",
|
315 | 319 | "",
|
316 | 320 | "\tbegin {",
|
317 |
| - "\t\t#BeginCodeHere", |
| 321 | + "\t\t${38:#BeginCodeHere}", |
318 | 322 | "\t}",
|
319 | 323 | "",
|
320 | 324 | "\tprocess {",
|
321 |
| - "\t\tif (\\$pscmdlet.ShouldProcess(\"Target\", \"Operation\")) {", |
322 |
| - "\t\t\t#ProcessCodeHere", |
| 325 | + "\t\tif (\\$pscmdlet.ShouldProcess(\"${39:Target}\", \"${40:Operation}\")) {", |
| 326 | + "\t\t\t${41:#ProcessCodeHere}", |
323 | 327 | "\t\t}",
|
324 | 328 | "\t}",
|
325 | 329 | "",
|
326 | 330 | "\tend {",
|
327 |
| - "\t\t#EndCodeHere", |
| 331 | + "\t\t${42:#EndCodeHere}", |
328 | 332 | "\t}",
|
329 | 333 | "",
|
330 | 334 | "\tclean {",
|
331 |
| - "\t\t#CleanCodeHere - Added in 7.3 for more information see https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions_advanced_methods?view=powershell-7.5#clean", |
| 335 | + "\t\t${43:#CleanCodeHere} - Added in 7.3 for more information see https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions_advanced_methods?view=powershell-7.5#clean", |
332 | 336 | "\t}",
|
333 | 337 | "}"
|
334 | 338 | ]
|
|
343 | 347 | ]
|
344 | 348 | },
|
345 | 349 | "Function: Suppress PSScriptAnalyzer Rule": {
|
346 |
| - "prefix": ["suppress-message-rule-function", "[SuppressMessageAttribute]"], |
| 350 | + "prefix": [ |
| 351 | + "suppress-message-rule-function", |
| 352 | + "[SuppressMessageAttribute]" |
| 353 | + ], |
347 | 354 | "description": "Suppress a PSScriptAnalyzer rule for a function. More: https://docs.microsoft.com/en-us/powershell/utility-modules/psscriptanalyzer/overview?view=ps-modules#suppressing-rules",
|
348 | 355 | "body": [
|
349 | 356 | "[Diagnostics.CodeAnalysis.SuppressMessageAttribute(",
|
|
356 | 363 | "Hashtable": {
|
357 | 364 | "prefix": "hashtable",
|
358 | 365 | "description": "A key/value store that are very efficient for finding and retrieving data. More: Get-Help about_Hash_Tables",
|
359 |
| - "body": ["\\$${1:Var} = @{", "\t${2:Name} = ${3:Value}", "}"] |
| 366 | + "body": [ |
| 367 | + "\\$${1:Var} = @{", |
| 368 | + "\t${2:Name} = ${3:Value}", |
| 369 | + "}" |
| 370 | + ] |
360 | 371 | },
|
361 | 372 | "Here-String": {
|
362 |
| - "prefix": ["hs", "here-string"], |
| 373 | + "prefix": [ |
| 374 | + "hs", |
| 375 | + "here-string" |
| 376 | + ], |
363 | 377 | "description": "Escape all text but evaluate variables. More: Get-Help about_Quoting_Rules",
|
364 |
| - "body": ["@\"", "${0:TM_SELECTED_TEXT}", "\"@", ""] |
| 378 | + "body": [ |
| 379 | + "@\"", |
| 380 | + "${0:TM_SELECTED_TEXT}", |
| 381 | + "\"@", |
| 382 | + "" |
| 383 | + ] |
365 | 384 | },
|
366 | 385 | "Here-String (Literal)": {
|
367 |
| - "prefix": ["hsl", "literal-here-string"], |
| 386 | + "prefix": [ |
| 387 | + "hsl", |
| 388 | + "literal-here-string" |
| 389 | + ], |
368 | 390 | "description": "Escape all text literally. More: Get-Help about_Quoting_Rules",
|
369 |
| - "body": ["@'", "${0:TM_SELECTED_TEXT}", "'@", ""] |
| 391 | + "body": [ |
| 392 | + "@'", |
| 393 | + "${0:TM_SELECTED_TEXT}", |
| 394 | + "'@", |
| 395 | + "" |
| 396 | + ] |
370 | 397 | },
|
371 | 398 | "Hidden Property": {
|
372 | 399 | "prefix": "class-proph-hidden",
|
373 | 400 | "description": "Useful for creating internal properties and methods within a class that are hidden from users. More: Get-Help about_Hidden",
|
374 |
| - "body": ["hidden [${1:string}] $${0:PropertyName}"] |
| 401 | + "body": [ |
| 402 | + "hidden [${1:string}] $${0:PropertyName}" |
| 403 | + ] |
375 | 404 | },
|
376 | 405 | "IArgumentCompleter Class": {
|
377 | 406 | "prefix": "iargument-completer",
|
|
0 commit comments