Skip to content

snippit PSCustomObject #1186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
timoline opened this issue Feb 3, 2018 · 3 comments
Closed

snippit PSCustomObject #1186

timoline opened this issue Feb 3, 2018 · 3 comments
Labels
Hackathon Up for grabs, especially at Hackathons! Up for Grabs Will shepherd PRs.

Comments

@timoline
Copy link

timoline commented Feb 3, 2018

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

@rkeithhill
Copy link
Contributor

rkeithhill commented Feb 3, 2018

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.

@timoline
Copy link
Author

timoline commented Feb 4, 2018

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"
}

@TylerLeonhardt TylerLeonhardt added the Hackathon Up for grabs, especially at Hackathons! label Feb 21, 2018
@TylerLeonhardt
Copy link
Member

This will be just a matter of adding these snippets to:
https://github.com/PowerShell/vscode-powershell/blob/master/snippets/PowerShell.json

@TylerLeonhardt TylerLeonhardt added the Up for Grabs Will shepherd PRs. label Mar 20, 2018
rschaeferhig pushed a commit to rschaeferhig/vscode-powershell that referenced this issue Mar 20, 2018
Added snippets for PSCustomObject and  Hashtable

Fixes PowerShell#1186
TylerLeonhardt pushed a commit that referenced this issue Mar 22, 2018
Added snippets for PSCustomObject and  Hashtable

Fixes #1186
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hackathon Up for grabs, especially at Hackathons! Up for Grabs Will shepherd PRs.
Projects
None yet
Development

No branches or pull requests

3 participants