From 31c04ac87452c6543b275edfcca735f9f45b1c6f Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Sun, 25 Mar 2018 09:38:28 -0700 Subject: [PATCH 1/2] Create community_snippets.md --- docs/community_snippets.md | 101 +++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 docs/community_snippets.md diff --git a/docs/community_snippets.md b/docs/community_snippets.md new file mode 100644 index 0000000000..61c0044479 --- /dev/null +++ b/docs/community_snippets.md @@ -0,0 +1,101 @@ +# Awesome VSCode Snippets for PowerShell + +> A curated list of awesome vscode snippets for PowerShell. + +*Inspired by the [awesome](https://github.com/sindresorhus/awesome) lists, focusing on PowerShell snippets in VSCode* + +## What are snippets + +Code snippets are templates that make it easier to enter repeating code patterns, such as loops or conditional-statements. Check out the [VSCode documentation on snippets](https://code.visualstudio.com/docs/editor/userdefinedsnippets). It provides an overview and instructions on how to author snippets. It's really simple - just a little bit of JSON. + +## How to contribute + +Check out our [guide here](#contributing). + +## Table of contents + +* Soon... + +## Snippets + +### Soon + +## Contributing + +If you'd like to add a snippet to this list, [open a pull request](https://opensource.guide/how-to-contribute/#opening-a-pull-request) with the following changes: + +### Table of context + +You need to add an item to the table of context. The addition should follow the alpha ordering of the list. +The ToC item template looks like this: + +```md +*[Name of snippet](link to header of your snippet): _some short description_ +``` + +An example looks like this (NOTE: all lowercase link): + +```md +*[PSCustomObject](#pscustomobject): _A simple PSCustomObject_ +``` + +which will show up in the ToC like this: + +* [PSCustomObject](#pscustomobject): _A simple PSCustomObject_ + +### Body + +You need to also add an item to the body in alpha order. The body item template looks like this: + + ### Name of snippet + + Enter your description here. It can be the same as the ToC or a longer version. + + #### Snippet + + ```json + { + "Put your":"snippet here", + "indent it":"properly" + } + ``` + +An example looks like this: + + ### PSCustomObject + + A simple PSCustomObject. + + #### Snippet + + ```json + "PSCustomObject": { + "prefix": "PSCustomObject", + "body": [ + "[PSCustomObject]@{", + "\t${1:Name} = ${2:Value}", + "}" + ], + "description": "Creates a PSCustomObject" + } + ``` + +which will show up in the body like this: + +### PSCustomObject + +A simple PSCustomObject. Note, this snippet ships with the PowerShell extension. + +#### Snippet + +```json +"PSCustomObject": { + "prefix": "PSCustomObject", + "body": [ + "[PSCustomObject]@{", + "\t${1:Name} = ${2:Value}", + "}" + ], + "description": "Creates a PSCustomObject" +} +``` From 3889df80ca7f0b29626830322cd9e6da2d7b9d40 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Mon, 23 Apr 2018 10:01:29 -0700 Subject: [PATCH 2/2] addsnip-and-table --- docs/community_snippets.md | 41 +++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/docs/community_snippets.md b/docs/community_snippets.md index 61c0044479..6e3814dfbb 100644 --- a/docs/community_snippets.md +++ b/docs/community_snippets.md @@ -4,21 +4,42 @@ *Inspired by the [awesome](https://github.com/sindresorhus/awesome) lists, focusing on PowerShell snippets in VSCode* +[![Awesome](https://awesome.re/badge.svg)](https://awesome.re) + ## What are snippets Code snippets are templates that make it easier to enter repeating code patterns, such as loops or conditional-statements. Check out the [VSCode documentation on snippets](https://code.visualstudio.com/docs/editor/userdefinedsnippets). It provides an overview and instructions on how to author snippets. It's really simple - just a little bit of JSON. -## How to contribute - -Check out our [guide here](#contributing). +_To contribute, check out our [guide here](#contributing)._ ## Table of contents -* Soon... +| Table of Contents | +|:-----------------:| +| [PSCustomObject](#pscustomobject): _A simple PSCustomObject by @brettmillerb_ | ## Snippets -### Soon +### PSCustomObject + +A simple PSCustomObject by @brettmillerb. It has 4 properties that you can tab through to quickly fill in. + +#### Snippet + +```json +"PSCustomObject": { + "prefix": "PSCustomObject", + "body": [ + "[PSCustomObject]@{\r", + "\t${item1} = ${Property1}\r", + "\t${item2} = ${Property2}\r", + "\t${item3} = ${Property3}\r", + "\t${item4} = ${Property4}\r", + "}" + ], + "description": "Creates a PSCustomObject" +} +``` ## Contributing @@ -26,22 +47,24 @@ If you'd like to add a snippet to this list, [open a pull request](https://opens ### Table of context -You need to add an item to the table of context. The addition should follow the alpha ordering of the list. +You need to add an item to the table of context. The addition should follow the *alpha ordering* of the list. The ToC item template looks like this: ```md -*[Name of snippet](link to header of your snippet): _some short description_ +| [Name of snippet](link to header of your snippet): _some short description_ | ``` An example looks like this (NOTE: all lowercase link): ```md -*[PSCustomObject](#pscustomobject): _A simple PSCustomObject_ +| [PSCustomObject](#pscustomobject): _A simple PSCustomObject_ | ``` which will show up in the ToC like this: -* [PSCustomObject](#pscustomobject): _A simple PSCustomObject_ +| Table of Contents | +|:-----------------:| +| [PSCustomObject](#pscustomobject): _A simple PSCustomObject_ | ### Body