pangloss / vim-javascript

Vastly improved Javascript indentation and syntax support in Vim.
http://www.vim.org/scripts/script.php?script_id=4452
3.79k stars 357 forks source link

Better distinguish statements from expressions #1249

Closed lassipulkkinen closed 2 years ago

lassipulkkinen commented 2 years ago

Restricts usage of jsAll to contexts where statements are allowed. This makes it possible to add jsBlock to jsAll (fixes #1228), which is also done here.

This also splits jsRepeatParen into jsWhileParen and jsForParen, since the syntaxes are obviously very different, and restricts of to jsForParen, since that's the only place where it actually has special meaning (this is still a bit crude, as it doesn't differentiate for-of from for...). Somehow miraculously there was already a highlighting rule for jsOf, so that didn't need to be added.

amadeus commented 2 years ago

I don't write much JS these days anymore (mostly typescript, and therefore a different plugin altogether). That said though, it looks like you put some good effort into this. I'll go ahead and merge it, although I don't really have time to test it, so I'll keep an eye out and may revert if there are issues, or if you could also keep an eye out and submit any follow ups if there are issues, that would be helpful as well!

lassipulkkinen commented 2 years ago

Thanks! I've been using this for the past few weeks and haven't encountered any issues, although obviously I did just force-push to fix a dumb typo, so there could be more..?

I won't necessarily be writing much JS in the near future either, though, as I kind of ended up abandoning the project I was working on when I submitted this.