-
Notifications
You must be signed in to change notification settings - Fork 510
Edited Snippet to fix issue #1353 #1354
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
Conversation
Add in Optional Parameters to the Parameter Block
I think this is a reasonable change. It's a lot easier to extend this to an advanced function/cmdlet after you start with this change. I'd like to hear from @rkeithhill and @rjmholt on what they think. |
Could we add this as another We already have two function snippets: |
@rkeithhill that is exactly why I've put forward the change - whilst it is second nature for a c# developer to declare them in this manner, even though it is accepted in PowerShell language, it is untidy when you look at it from a purely PowerShell standpoint and to newcomers that aren't devs but coming from SysAdmin side. I'd be suggestive of adding the C# type snippet back in with this PR but calling it If that sounds good I'll add a further commit to address this to this PR and it can be added all together. Edit - pushed commit to add back in the old function snippet but renamed to function-noparam |
snippets/PowerShell.json
Outdated
"\t$0", | ||
"}" | ||
], | ||
"description": "function definition snippet that does not contain a param block and is more typically seen in C#" |
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.
How about we describe this as just function definition snippet with inline parameters
?
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.
Could do but I think this is more informative, and explains in not too much info where a user may see this syntax elsewhere
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.
Well, my main objection is that the last bit about "and is more typically seen in C#" reads a bit too "opinionated" IMO. :-) Maybe just remove that bit?
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.
I agree that the default function
snippet should use the param
block by default and we should keep the inline function snippet as well.
Maybe Function-Inline
is more descriptive than function-NoParam
?
Our name-casing seems to be a bit strange. I get the impression that function
is so because of the keyword, but I'm thinking that since Function-Advanced
has both uppercase, so should the renamed snipped if it has a suffix.
@rkeithhill @rjmholt @tylerl0706 have made amendments as requested - just waiting on the build to finish |
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.
LGTM
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.
LGTM
Thanks for your contribution @kilasuit! |
PR Summary
This PR is to edit the basic Function Snippet to be more Powershell specific than C# in nature and fixes #1353
PR Checklist
Note: Tick the boxes below that apply to this pull request by putting an
x
between the square brackets.Please mark anything not applicable to this PR
NA
.WIP:
to the beginning of the title and remove the prefix when the PR is ready