[SVN] Whitespace sensitive code folding

Tim Caswell tim at creationix.com
Mon Aug 17 15:01:26 UTC 2009


I'm writing a language that is whitespace sensitive like python or  
haml and I'm having trouble getting code folding right.

If this example:

Toolbar {left: 0, top: 0, right: 0, height: 32} // start block here
	Label {centerY: 0, height: 24, left: 8, width: 200}
		value: "Todos"

	Button {centerY: 0, height: 24, right: 12, width: 100}
		title: "Add Task"
		action: button.addTask // end block here

// This is a comment
List {top: 36, bottom: 32, left: 0, right: 0, scrollY: true}

I want every constructor (Line starting with capital) to open a block,  
and the last line with content before the first line that's indented  
same or less is the end.

I looked at the python bundle, and It doesn't seem to be doing  
anything special, so I'm not sure what to do.

Here is what I got so far:

	foldingStartMarker = '^\s*[A-Z][a-z]*\s+(\{[^}]*\})$';
	foldingStopMarker = '^\s*$';




More information about the textmate-dev mailing list