[TxMt] Symbol popup
Allan Odgaard
throw-away-1 at macromates.com
Mon Nov 14 17:28:09 UTC 2005
On 14/11/2005, at 11.19, Graeme Mathieson wrote:
> I suspect you're going to say 'no, it's a limitation of the way the
> parsing is done', but would it be possible to collapse white space
> in the display of symbols?
Or I could say RTFM :)
[NEW] It's possible to provide one or more regexp
transformations to be applied
to the symbols extracted via the showInSymbolList bundle
preference item. This is
done as a scope specific preference (symbolTransformation) and
the format of the
value is: “s/«regexp»/«format»/«options»” optionally followed by
“;” and more
regexp transformations. The format string is as in other places
(see Help ->
Regular Expressions) so there is support for conditional
insertions, case folding
and similar. For a simple example, see e.g. the Python or Ruby
bundle (Symbol
List preferences), for a slightly more advanced example, see the
Objective-C
bundle.
So that'd be:
symbolTransformation = 's/\s+/ /g';
With scope set to the thing for which you want the white space
collapsed. You could also do:
symbolTransformation = 's/\s+/ /g; s/^(.{30}).+$/$1…/';
Then it collapses white space and chops of anything after the 30th
character and add ellipsis :)
Be aware that if this is Python methods, a symbol transformation is
already setup for the scope (so edit that, or better, include what it
does in yours, and give yours a more exact scope to make it win).
However, I'll add white space collapsing as the default, since it
makes sense.
> Actually, on a related note, it would be really nice if the auto-
> indentation would behave in the way I want it to for indented
> function arguments. That is, if I hit enter inside an open
> bracket, the next line should be indented to one beyond the open
> bracket on the previous line. And when the corresponding closed
> bracket happens, the indentation should revert to what it was
> before [...] Is it possible to do this?
Well, it could be done, but requires some work.
You'll have to do a command that does figure out the indent -- see
e.g. the Markdown bundle which has a command which inserts as many
='s as the line above, you'd use a similar technique -- then you'd
have to put this on return but limit the scope to something like
declaration.parameter.
So it's not a simple preference you can tweak.
More information about the textmate
mailing list