[These are pretty much 101 level posts]
Still distracted obviously, while on a conference call I was grazing through my VSCode PowerShell snippet file. I came across probably the most basic snippet and noticed it was not only lacking but missing some snippet magic:
Look at that mess. What is wrong?:
- When used it pastes the function shell but missing the closing curly bracket
- The $1() does nothing useful and we know the name of the function should be there.
- The $0 was right but again with no closing curly bracket why
So ashamed of myself, okay not really but a chance to improve with what I have learned
The revised version:
- Creates a basic function shell.
- The FunctionName term is highlighted first, so you enter the function name before beginning which just seems right.
- Once we give the function a name (Verb-Noun of course) we press Tab and we can start replacing “# Code goes here” with the contents of the function.
- The closing bracket is there and inline.
This is what it looks like in use.
Now to go back and fix up my other half-baked snippets and watch to see if I can discover new tricks as the community posts their snippets.