From f482aa9c0dab33612ad6189cf6ac9cbcdca75dfc Mon Sep 17 00:00:00 2001 From: "Travis C. LaGrone" <22419287+travis-c-lagrone@users.noreply.github.com> Date: Mon, 1 Jul 2019 20:41:31 -0500 Subject: [PATCH 1/3] Remove snippet named 'Cmdlet', which is duplicate of 'Function-Advanced' Decision to remove 'Cmdlet' instead of 'Function-Advanced' is because a function defined in PowerShell with the 'CmdletBinding' attribute is technically an advanced function rather than a cmdlet, which would be defined in C# with the 'Cmdlet' attribute. --- snippets/PowerShell.json | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/snippets/PowerShell.json b/snippets/PowerShell.json index 2716e42b6d..c18a28cdca 100644 --- a/snippets/PowerShell.json +++ b/snippets/PowerShell.json @@ -512,30 +512,6 @@ ], "description": "Enum definition snippet" }, - "Cmdlet": { - "prefix": "cmdlet", - "body": [ - "function ${1:Verb-Noun} {", - "\t[CmdletBinding()]", - "\tparam (", - "\t\t$0", - "\t)", - "\t", - "\tbegin {", - "\t\t", - "\t}", - "\t", - "\tprocess {", - "\t\t$TM_SELECTED_TEXT", - "\t}", - "\t", - "\tend {", - "\t\t", - "\t}", - "}" - ], - "description": "Script cmdlet definition snippet" - }, "Function-Advanced": { "prefix": "function-advanced", "body": [ @@ -931,7 +907,7 @@ "body": [ "[Diagnostics.CodeAnalysis.SuppressMessageAttribute('${1:PSProvideDefaultParameterValue}', '', Scope='Function', Target='${2:*}')]" ] - }, + }, "PSCustomObject": { "prefix": "PSCustomObject", "body": [ From 58646792cd87565b9688c6123d79049abc859ddc Mon Sep 17 00:00:00 2001 From: "Travis C. LaGrone" <22419287+travis-c-lagrone@users.noreply.github.com> Date: Wed, 3 Jul 2019 13:35:40 -0500 Subject: [PATCH 2/3] Add second prefix 'cmdlet' to snippet name 'Function-Advanced' 'cmdlet' is an ISE compatibility snippet prefix, but is identical to (and is more accurately described as) the 'function-advanced' snippet. --- snippets/PowerShell.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/snippets/PowerShell.json b/snippets/PowerShell.json index c18a28cdca..07ffb43d1f 100644 --- a/snippets/PowerShell.json +++ b/snippets/PowerShell.json @@ -513,7 +513,10 @@ "description": "Enum definition snippet" }, "Function-Advanced": { - "prefix": "function-advanced", + "prefix": [ + "function-advanced", + "cmdlet" + ], "body": [ "function ${1:Verb-Noun} {", "\t[CmdletBinding()]", From 787f6d295720fb01051a58b4eefa5dd185b1b1cf Mon Sep 17 00:00:00 2001 From: "Travis C. LaGrone" <22419287+travis-c-lagrone@users.noreply.github.com> Date: Wed, 3 Jul 2019 13:38:41 -0500 Subject: [PATCH 3/3] Rename snippet 'Cmdlet-Comment-Help' to 'Comment-Help' This is a parallel change to @58646792cd87565b9688c6123d79049abc859ddc, because--strictly speaking--comment-based help does not apply to a cmdlet but rather to an advanced function. --- snippets/PowerShell.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/PowerShell.json b/snippets/PowerShell.json index 07ffb43d1f..427b359574 100644 --- a/snippets/PowerShell.json +++ b/snippets/PowerShell.json @@ -539,7 +539,7 @@ ], "description": "Script advanced function definition snippet" }, - "Cmdlet-Comment-Help": { + "Comment-Help": { "prefix": "comment-help", "body": [ "<#", @@ -558,7 +558,7 @@ "\tGeneral notes", "#>" ], - "description": "Comment-based help snippet" + "description": "Comment-based help for an advanced function snippet" }, "Parameter": { "prefix": "parameter",