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
js-mode function snippet does not generate canonical javascript function syntax for anonymous functions #101
Comments
@cowboyd try that fix and I'll merge it if it's better.. The alternative could be make two snippets choosing with the same key, so choosing early on if it should be a named or anonymous function, what do you think? |
Just saw this. I'll give it a try. |
So after trying this for awhile, I really like this snippet, but I find myself missing the old behavior of just getting the quick anonymous function... especially, since this is something like 90% of the usecases. What would you think of |
I'm not too sure @cowboyd, because
So I'll leave it like that for now I think.. |
I'll just throw in my final $.02:
The original behavior change threw me for a loop as I had been using
I don't think this is supported by the evidence. If you look at most large and popular codebases, when assigning functions to a prototype or as a property in an object literal, or as an iterator in an You'll find a similar situation in the Angular and Ember codebases to name some more high profile examples. Of course, this is just a few examples of the myriad JavaScript repositories out there, but I think they are very representative of the mainstream, and maintained by organizations that place a premium on best practices and coding standards. Whatever you decide, let me say thank you for maintaining and improving these snippets. They are very helpful, and improve the productivity of both me and my team. Cheers. |
The javascript function snippet introduced here 99e72dd
When the
name
snippet parameter is skipped, thefunction.el
snippet will generate a function expression like sobut by far the most common style is to not have a space in between the function keyword and parameter list for anonymous functions:
Almost any example you'll find on the web uses this style found here at mozdev on the function statement documentation:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function
The text was updated successfully, but these errors were encountered: