-
Notifications
You must be signed in to change notification settings - Fork 514
Add new snippet for #region #1368
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
<!-- markdownlint-disable MD024 --> | ||
|
||
# Awesome VSCode Snippets for PowerShell | ||
|
||
> A curated list of awesome vscode snippets for PowerShell. | ||
|
@@ -28,6 +30,7 @@ _To contribute, check out our [guide here](#contributing)._ | |
| [PesterTestForMandatoryParameter](#pestertestformandatoryparameter) | _Create Pester test for a mandatory parameter_ | | ||
| [PesterTestForParameter](#pestertestforparameter) | _Create Pester test for parameter_ | | ||
| [PSCustomObject](#pscustomobject) | _A simple PSCustomObject by @brettmillerb_ | | ||
| [Region Block](#region-block) | _Region Block for organizing and folding of your code_ | | ||
|
||
## Snippets | ||
|
||
|
@@ -271,6 +274,7 @@ Quickly create a Pester Test for existence of a parameter by @SQLDBAWithABeard | |
"description": "Pester Test for Parameter" | ||
} | ||
``` | ||
|
||
### PSCustomObject | ||
|
||
A simple PSCustomObject by @brettmillerb. It has 4 properties that you can tab through to quickly fill in. | ||
|
@@ -292,6 +296,24 @@ A simple PSCustomObject by @brettmillerb. It has 4 properties that you can tab t | |
} | ||
``` | ||
|
||
### Region Block | ||
|
||
Use the `#region` for organizing your code (including good code folding). | ||
|
||
#### Snippet | ||
|
||
```json | ||
"Region Block": { | ||
"prefix": "#region", | ||
"body": [ | ||
"#region ${1}", | ||
"${2}", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do people typically put the region tag after I've always seen:
vs
I'm not sure There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In C# the most common form I've seen is: #region Private variables
private readonly IEnumerable<string> _strs = new [] { "hello", "goodbye" };
private string _greeting = "Aloha";
#endregion // Private variables I would imagine the PowerShell version of that is: #region My region
...
#endregion # My region There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess in PowerShell the region is already commented out, but that's an implementation detail from the line-comment delimiter and the pragma start-char being the same in my mind. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My first pref (by a smidge) would be:
Second would be:
But either would be fine by me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like if both @tylerl0706 and @rkeithhill agree on a first preference then it should be that 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✓ |
||
"#endregion" | ||
], | ||
"description": "Region Block for organizing and folding of your code" | ||
} | ||
``` | ||
|
||
## 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: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should move this to the .vscode/settings.json file? This would probably apply to the CHANGELOG as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This slipped in by accident.
I am waiting on the merge of this one to create the next with this line --> which I just moved to settings.json