[SVN] Re: Align Source
Allan Odgaard
mailinglist at textmate.org
Tue May 24 20:59:06 UTC 2011
On 24 May 2011, at 22:43, Mads Hartmann Jensen wrote:
> Just improved the code so it will sort the regular expressions such that the
> regular expression whose captures has the lowest offset (across all lines)
> is used to align first. Provides a better end result in many cases imo :)
>
> This will however means that the developers have no change of choosing the
> precedence of regular expressions (previously the regexps had to highest
> precedence from left to right in the array).
Sounds acceptable — since these are regexps, one can actually influence it partially by matching a larger part of the line, for example use negative look-ahead if we don’t want a certain pattern to be active say, when a line contains a trailing line comment, etc.
It would be nice if the algorithm strips whitespace before doing the width calculation, for example:
1. foo = "bar"
2. abracadabra = "magic"
3. answer = 42
Now if I remove the second line and run the aligner, it won’t decrease the excessive amount of whitespace.
More information about the textmate-dev
mailing list