Skip to content

Update javascript.vim #437

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 6 commits into from
May 21, 2016
Merged

Update javascript.vim #437

merged 6 commits into from
May 21, 2016

Conversation

bounceme
Copy link
Collaborator

yesterday's commit was still a little buggy, sorry. this should be better

yesterday's commit was still a little buggy, sorry. this should be better
@amadeus
Copy link
Collaborator

amadeus commented May 19, 2016

Hope I'm not a pain, but can you outline what this fixes?

@bounceme
Copy link
Collaborator Author

mostly I think my usage of the search pair command was wrong, best to give an example though:

var magicWords = ['abracadabra', 'gesundheit', 'ventrilo'],
  spells = {
    'fireball': function() {
      setOnFire()
    },
    'water': function() {
      putOut()
    }
  },
  a = 1,
  b = 'abc',
  etc, somethingElse
someFunc(param1, param2,
  param3, param4)

at the moment this 'inMultiVarIndent' function traverses the curly braces of the spells object. I was close yesterday but for search pair you are generally going to have a few bugs. this is what the indent will look now, you can try with yesterday's and see the difference, basically the rest of the file is broken.

the comma logic is not based on regex anymore so this is safe to remove, this should be good for performance also
@bounceme
Copy link
Collaborator Author

by the way, @amadeus , can class declarations be 'chained' like var statements?

@amadeus
Copy link
Collaborator

amadeus commented May 19, 2016

I assume you mean like:

var ClassVar = class {};

If so, yes, that is valid JS

@bounceme
Copy link
Collaborator Author

no, like multiple class declarations seperated by commas

@amadeus
Copy link
Collaborator

amadeus commented May 19, 2016

So like:

class Test1 {}, class Test2 {};

If so, no, that is not valid JS, you will get a syntax error on the ,.

@bounceme
Copy link
Collaborator Author

and this?

class Test1 {},
Test2 {};

@bounceme
Copy link
Collaborator Author

chrome dev tools views it as an error at least

@amadeus
Copy link
Collaborator

amadeus commented May 19, 2016

Yeah, that's now allowed. Think of a class definition like named functions:

class Durp {}
function Durp(){}

They follow the same types of rules - like when you do a named function WITHOUT a var, a ; is not necessary

@bounceme
Copy link
Collaborator Author

this is ready!

@bounceme
Copy link
Collaborator Author

any objections?

@amadeus
Copy link
Collaborator

amadeus commented May 21, 2016

Can you squash the commits into one commit? Or at least edit the commit messages to be a bit more descriptive? Otherwise, I am good with this.

@bounceme bounceme merged commit 77387ef into develop May 21, 2016
@bounceme bounceme deleted the bounceme-patch-1 branch May 21, 2016 20:51
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.

2 participants