Skip to content
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

Javascript arguments #59

Merged
merged 10 commits into from
Jan 6, 2015
Merged

Javascript arguments #59

merged 10 commits into from
Jan 6, 2015

Conversation

LFDM
Copy link
Contributor

@LFDM LFDM commented Dec 29, 2014

Splitjoins javascript function arguments.

Implementation is simply done by extracting and reusing functions already present inside js.vim. It might be even more generalizable by moving these helper functions to the main sj helper 'module', but this decision I would leave to you, @AndrewRadev.

Also fixes minor issues with semicolon handling in javascript. Splitjoining functions were producing js that wouldn't make it through a linter like jshint.

Note that this currently sits on top of #58 and should not be merged. Depending on the fate of #58 I would rebase or cherry-pick this accordingly before taking further action.

Closes #53

@AndrewRadev
Copy link
Owner

Looks good to me. I did something similar for python lists/tuples, and I left the helpers as script-local functions.

I don't indent to extract them, since there are some javascript-specific things, particularly indentation. I'd say this is good enough as it is.

Thanks for your work :).

AndrewRadev added a commit that referenced this pull request Jan 6, 2015
@AndrewRadev AndrewRadev merged commit 55410de into AndrewRadev:master Jan 6, 2015
@AndrewRadev
Copy link
Owner

I've had to make some changes to javascript if-clause handling due to issue #67.

Long story, short, I now have a branch called if-clauses-with-curly braces in which I've overwritten the javascript if-clause handling with the PHP one (since I wanted to unify them and I had to pick one and this one was implemented by me :P). This may mean that I've made mistakes in the implementation and I'd appreciate it if you could take a look (either at the implementation, or just try it out and see if it seems to work alright).

Also note that there's a variable now, g:splitjoin_javascript_if_clause_curly_braces, which controls whether curly braces are added or not upon splitting/joining. Its value is not a boolean flag as usual, but I've documented it, so I hope it's understandable how it works. Otherwise, do let me know :).

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 arguments in javascript
2 participants