jarod2d/sublime_valign

Alignment not working with es6 notation

Opened this issue · 1 comments

The grouping logic does not perform as expected with javascript ES6 objects, e.g.

{
    otherVarInBlock: this.config.something,
    sameName,
    somethingElse: this.config.someOtherThing,
    someVar:       this.config.someOtherVar,
}

I would expect all values that follow a : to align, though I suppose that might be subjective.

If it was possible to highlight lines and apply alignment with a second keyboard shortcut that would be a totally acceptable solution though.

Thanks for the suggestion! The concern I have with that behavior is that the logic for when to stop searching for surrounding lines to align becomes fuzzy. I like the simple, predictable behavior, and I personally tend to align lines only if they're immediately adjacent anyways.

I do like the idea of aligning based on the highlighted lines if multiple lines are selected though. I think that's a great compromise between the two behaviors.

Unfortunately I'm completely swamped with other work though, so I won't be able to implement that any time soon. But I'm happy to take a look at PRs if you or anyone else wants to take a stab at it.