We have several of the same snippets in our snippets json:
"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": {
"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"
},
This could be avoided by supporting an array of prefixes like so:
"Cmdlet": {
"prefix": ["function-advanced", "cmdlet"], // <--- here
"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"
}
It'd help slim down snippet json files and support snippets that might go by different names.
Hi, can I try this one? I'm new to this repo. :)
Great. Some code pointers to get you started
prefix can be a string or an array here_parseSnippet-method. You are best off to create and push a new snippet per prefix when it is an arrayHi @jrieken thanks for this detailed howto.
@jrieken can you take a quick look at my implementation?
Done! All thanks to @noamyogev84 馃憦 馃弲
Nice work, @noamyogev84!! 馃帀
@jrieken @tylerl0706
Thanks guys!
Most helpful comment
Nice work, @noamyogev84!! 馃帀