[TxMt] help on folding rules

Gerd Knops gerti-textmate at bitart.com
Sun Jun 10 16:43:51 UTC 2007


On Jun 10, 2007, at 11:13 AM, Allan Odgaard wrote:

> On 10. Jun 2007, at 17:56, Jenny Harrison wrote:
>
>> Is there any chance of allowing misalignment of folding markers in  
>> 2.0? I have found that the indentation of folding markers can be  
>> inadvertently changed during standard text editing and must be  
>> corrected by hand.   Logically, the begin and end tags are still  
>> well defined, even though they might have mismatching indents.
>
> They are not always logically defined when indent is ignored (and  
> certainly not with the current regexp system, i.e. where no logical  
> pairing of begin/end markers is defined).
>
> But it is a common request to get more flexibility in the system,  
> so I am considering it, though I have yet to see a good proposal  
> for how to improve it ;)
>
Some ideas:

* Gobble up trailing empty lines
* Allow some fold markers to consolidate with the previous line

so that this:

- (void)method1
{
	// code
}

- (void)method2
{
	// code
}

neatly folds into:

=>- (void)method1
=>- (void)method2

* Purely indentation based folding. I have a bunch of files optimized  
for this from my jEdit days, and code in some languages with no  
obvious fold markers can be written to support this. I guess python  
folks would like this too.

* Make some assembler programmers happy: Indentation based folding,  
but with a pattern that if it applies makes a line being ignored for  
fold markers. Example:

func1:		code
		code
.local1:	code
		jmp .label1

func2:		code
		code

Here labels prefixed with a '.' are local labels. Ideally the above  
should fold to:

=>func1:
=>func2:

Gerd




More information about the textmate mailing list