Sorry I ask again to add a snippit..:-)
but Is it possible you add a snippit for PSCustomObject
e.g
[PSCustomObject]@{
Name = $Name
Description = $Description
Path = $Path
}
Or is there already a snippit for it?
thanx
No such snippet exists atm. I'm not sure about the utility of the snippet as defined above since my PSCustomObject is very likely to have different fields than your PSCustomObject (Name, Description, Path). So the expansion wouldn't save me much if I had to delete most of it.
Perhaps the snippet could be tweaked to define a single name/value set of placeholders.
BTW you can pretty easily create your own custom snippets - see https://code.visualstudio.com/docs/editor/userdefinedsnippets#_creating-your-own-snippets
This would give you a chance to experiment with the snippet and hone it.
ok very good point, thanks
I'll have a look at the userdefined snippits
something like this:
"PSCustomObject": {
"prefix": "PSCustomObject",
"body": [
"[PSCustomObject]@{",
"\t${1:Name} = ${2:Value}",
"}"
],
"description": "Creates a PSCustomObject"
}
and for hashtable
"Hashtable": {
"prefix": "Hashtable",
"body": [
"\\$${1:Var} = @{",
"\t${2:Name} = ${3:Value}",
"}"
],
"description": "Creates a Hashtable"
}
This will be just a matter of adding these snippets to:
https://github.com/PowerShell/vscode-powershell/blob/master/snippets/PowerShell.json
Most helpful comment
No such snippet exists atm. I'm not sure about the utility of the snippet as defined above since my PSCustomObject is very likely to have different fields than your PSCustomObject (Name, Description, Path). So the expansion wouldn't save me much if I had to delete most of it.
Perhaps the snippet could be tweaked to define a single name/value set of placeholders.
BTW you can pretty easily create your own custom snippets - see https://code.visualstudio.com/docs/editor/userdefinedsnippets#_creating-your-own-snippets
This would give you a chance to experiment with the snippet and hone it.