Skip to content

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

Merged
merged 5 commits into from
Jun 12, 2018
Merged

Edited Snippet to fix issue #1353 #1354

merged 5 commits into from
Jun 12, 2018

Conversation

kilasuit
Copy link
Contributor

@kilasuit kilasuit commented Jun 9, 2018

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.

  • PR has a meaningful title
  • Summarized changes
  • This PR is ready to merge and is not work in progress
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready

Add in Optional Parameters to the Parameter Block
@TylerLeonhardt
Copy link
Member

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.

@rkeithhill
Copy link
Contributor

Could we add this as another function* snippet? I tend to write a lot of tiny little functions where inline param decl is just fine and rarely changes.

We already have two function snippets: function and function-advanced. What should we call this third option? Maybe "function-param"?

@kilasuit
Copy link
Contributor Author

kilasuit commented Jun 11, 2018

@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 Function-NoParam because we should be focusing people to use the more PowerShell language than C# language especially as this is a PowerShell extension.

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

"\t$0",
"}"
],
"description": "function definition snippet that does not contain a param block and is more typically seen in C#"
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor

@rjmholt rjmholt left a 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.

@kilasuit
Copy link
Contributor Author

@rkeithhill @rjmholt @tylerl0706 have made amendments as requested - just waiting on the build to finish

Copy link
Contributor

@rkeithhill rkeithhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rjmholt rjmholt merged commit 9bf58a7 into PowerShell:master Jun 12, 2018
@rjmholt
Copy link
Contributor

rjmholt commented Jun 12, 2018

Thanks for your contribution @kilasuit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Function Snippet should not output in a C# way
5 participants