Skip to content

Commit 320d729

Browse files
committed
Add more placeholders
1 parent b4ea3f9 commit 320d729

File tree

1 file changed

+76
-47
lines changed

1 file changed

+76
-47
lines changed

snippets/PowerShell.json

Lines changed: 76 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -240,95 +240,99 @@
240240
]
241241
},
242242
"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+
],
244247
"description": "Script advanced function definition with full comment-based help and parameter attributes.",
245248
"body": [
246249
"function ${1:Verb-Noun} {",
247250
"\t<#",
248251
"\t.SYNOPSIS",
249-
"\tShort description",
252+
"\t${2:Short description}",
250253
"\t.DESCRIPTION",
251-
"\tLong description",
254+
"\t${3:Long description}",
252255
"\t.EXAMPLE",
253-
"\tExample of how to use this cmdlet",
256+
"\t${4:Example of how to use this cmdlet}",
254257
"\t.EXAMPLE",
255-
"\tAnother example of how to use this cmdlet",
258+
"\t${5:Another example of how to use this cmdlet}",
256259
"\t.INPUTS",
257-
"\tInputs to this cmdlet (if any)",
260+
"\t${6:Inputs to this cmdlet (if any)}",
258261
"\t.OUTPUTS",
259-
"\tOutput from this cmdlet (if any)",
262+
"\t${7:Output from this cmdlet (if any)}",
260263
"\t.NOTES",
261-
"\tGeneral notes",
264+
"\t${8:General notes}",
262265
"\t.COMPONENT",
263-
"\tThe component this cmdlet belongs to",
266+
"\t${9:The component this cmdlet belongs to}",
264267
"\t.ROLE",
265-
"\tThe role this cmdlet belongs to",
268+
"\t${10:The role this cmdlet belongs to}",
266269
"\t.FUNCTIONALITY",
267-
"\tThe functionality that best describes this cmdlet",
270+
"\t${11:The functionality that best describes this cmdlet}",
268271
"\t#>",
269-
"\t[CmdletBinding(DefaultParameterSetName = 'Parameter Set 1',",
272+
"\t[CmdletBinding(DefaultParameterSetName = '${12:ParameterSet1}',",
270273
"\t\tSupportsShouldProcess,",
271-
"\t\tPositionalBinding",
272-
"\t\tHelpUri = 'http://yourwebsiteforhelp.here',",
274+
"\t\tPositionalBinding,",
275+
"\t\tHelpUri = '${13:http://yourwebsiteforhelp.here}',",
273276
"\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}])]",
276279
"\tparam (",
277-
"\t\t# Param1 help description",
280+
"\t\t# ${18:Param1} help description",
278281
"\t\t[Parameter(Mandatory,",
279282
"\t\t\tValueFromPipeline,",
280283
"\t\t\tValueFromPipelineByPropertyName,",
281284
"\t\t\tValueFromRemainingArguments,",
282285
"\t\t\tPosition = 0,",
283-
"\t\t\tParameterSetName = 'Parameter Set 1')]",
286+
"\t\t\tParameterSetName = '${12:ParameterSet1}')]",
284287
"\t\t[ValidateNotNull()]",
285288
"\t\t[ValidateNotNullOrEmpty()]",
286289
"\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},",
290293
"",
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}')]",
293296
"\t\t[AllowNull()]",
294297
"\t\t[AllowEmptyCollection()]",
295298
"\t\t[AllowEmptyString()]",
296-
"\t\t[ValidateScript({ \\$true })]",
299+
"\t\t[ValidateScript({ ${25:true} })]",
297300
"\t\t[ValidateRange(0, 5)]",
298-
"\t\t[int]",
299-
"\t\t\\$Param2,",
301+
"\t\t[${26:int}]",
302+
"\t\t$${24:Param2},",
300303
"",
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]*}\")]",
304307
"\t\t[ValidateLength(0, 15)]",
305-
"\t\t[String]",
306-
"\t\t\\$Param3",
308+
"\t\t[${31:String}]",
309+
"\t\t$${28:Param3},",
307310
"",
311+
"\t\t# ${33:Param4} help description",
308312
"\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}'})]",
311315
"\t\t[ValidateLength(0, 15)]",
312-
"\t\t[String]",
313-
"\t\t\\$Param4",
316+
"\t\t[${36:String}]",
317+
"\t\t$${33:Param4}",
314318
"\t)",
315319
"",
316320
"\tbegin {",
317-
"\t\t#BeginCodeHere",
321+
"\t\t${38:#BeginCodeHere}",
318322
"\t}",
319323
"",
320324
"\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}",
323327
"\t\t}",
324328
"\t}",
325329
"",
326330
"\tend {",
327-
"\t\t#EndCodeHere",
331+
"\t\t${42:#EndCodeHere}",
328332
"\t}",
329333
"",
330334
"\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",
332336
"\t}",
333337
"}"
334338
]
@@ -343,7 +347,10 @@
343347
]
344348
},
345349
"Function: Suppress PSScriptAnalyzer Rule": {
346-
"prefix": ["suppress-message-rule-function", "[SuppressMessageAttribute]"],
350+
"prefix": [
351+
"suppress-message-rule-function",
352+
"[SuppressMessageAttribute]"
353+
],
347354
"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",
348355
"body": [
349356
"[Diagnostics.CodeAnalysis.SuppressMessageAttribute(",
@@ -356,22 +363,44 @@
356363
"Hashtable": {
357364
"prefix": "hashtable",
358365
"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+
]
360371
},
361372
"Here-String": {
362-
"prefix": ["hs", "here-string"],
373+
"prefix": [
374+
"hs",
375+
"here-string"
376+
],
363377
"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+
]
365384
},
366385
"Here-String (Literal)": {
367-
"prefix": ["hsl", "literal-here-string"],
386+
"prefix": [
387+
"hsl",
388+
"literal-here-string"
389+
],
368390
"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+
]
370397
},
371398
"Hidden Property": {
372399
"prefix": "class-proph-hidden",
373400
"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+
]
375404
},
376405
"IArgumentCompleter Class": {
377406
"prefix": "iargument-completer",

0 commit comments

Comments
 (0)