Hi,
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? See the attached example. The file itself has these items being split by a newline and indentation...
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. As an example:
tickets = self.sql.listTickets(ticket_id = id, /* Caret should be placed at the '/' of this comment. */ support_of = 123, account = 'foo@acmewidgets.example') /* Caret should be placed at the '/' of this comment. */
Is it possible to do this?
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.
On 14 Nov 2005, at 17:28, Allan Odgaard wrote:
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 :)
Oops, thanks for the pointer. The preference I came up with (for Python) in the end was:
/* preferences */ { showInSymbolList = 1; symbolTransformation = 's/^\s*def\s+(.*):$/ $1/; s/\s+/ /g; s/ *=.*? (,|))/$1/g; s/^(.*(.{30}).*?(.{30}))/$1...$2/'; }
which removes default arguments, collapses white space, and truncates arguments to the first 30 and last 30 characters if it's longer than 60 characters. Works nicely for me...
Hello TextMate's ,
I am trying to create a pattern for showing symbols in the popup tab and the window, for the SuperCollider programming language (http://www.sourceforge.net/projects/supercollider/) I copied the Ruby preferences bundle and put it in the preferences for language SuperCollider which I modified from C. I cannot get any further by trying to modify the Ruby pattern in the SuperCollider preferences. I suspect this has to do with the Scope Selector setting. Can someone explain how to proceed to make this work?
The patterns I want to have in my symbol list are those matching:
1. Class definition: (capitalized word at beginning of line, including optional digits and _, followed by { ): AnyCapitalizedWord_123 { or: AnyCapitalizedWord_123 : NameOfSuperClass {
2. Class method definition: (linefeed, then tab, followed by asterisk * followed by small letter word with optional digits and _ followed by space then { ) Example: *smallLetterWord_123 { (anything else here)
2. Instance method definition: (as above without asterisk) Example: smallLetterWord_123 { (anything else here)
It is a mystery to me why some languages that do not have the showInSymbolList and SymbolTransformation keys set in their preferences still show symbols in their lists.
Thanks,
Iannis Zannos
On 7/12/2005, at 21:12, Iannis Zannos wrote:
[...] It is a mystery to me why some languages that do not have the showInSymbolList and SymbolTransformation keys set in their preferences still show symbols in their lists.
The Source bundle sets the key for entity.name.function/class by default.
It's work-in-progress (= incomplete and lacks proof-reading etc.), but here's the preliminary documentation for the symbol pop-up: http://macromates.com/doc/navigation_overview.html#customizing_the_list