I just opened a 1.5M XML document in TM. My XML syntax isn't all that lean, and it takes a while for TM to highlight everything and become responsive. Currently, I do not know of any way to open a file without syntax highlighting. That'd be one nice thing to have... The other would be for TM to pop up a little dialog if highlighting hasn't completed after, say, 10 seconds and give the option to abort the open, continue highlighting (until done), or open without highlighting.
On Dec 2, 2004, at 14:23, Brian Lalor wrote:
I just opened a 1.5M XML document in TM. My XML syntax isn't all that lean, and it takes a while for TM to highlight everything and become responsive.
Exactly what is slow? TextMate does lazy parsing of the file, so it won't parse more than what's required to display the visible portion (that's basically everything from the first line to the last visible line -- and it caches previously parsed lines).
So generally (i.e. when the caret isn't saved as meta data and/or is not placed way down in the file) syntax highlight shouldn't affect loading time -- but it does affect scroll times (for the first time you scroll through the document).
Scanning for folding markers OTOH is not lazy, and that's currently the (huge) bottleneck in loading files -- I did improve it slightly, which is what broke the open files folded, but it still does a scan of the entire file. You can disable foldings in the View -> Gutter menu, and it should significantly improve loading times (relative to file size and computer speed of course).
Long term scanning for folding markers will be lazy and I'll try to have SH parsing and folding scanning done in separate threads, and display text even before these complete, so that load/scroll will be “instant”, but then at times with styles/folding markers appearing with a slight delay.
On Dec 3, 2004, at 9:47 PM, Allan Odgaard wrote:
Scanning for folding markers OTOH is not lazy, and that's currently the (huge) bottleneck in loading files
That's probably what I'm seeing; that or just the time it takes to load a 1.5M file. Most files I work with are quite a bit smaller.
My XML syntax is here[1], and the folding properties are: foldingStartMarker = "^\s*(<[^!?%/](?!.+?/>)|<[!%]--(?!.+?--%?>)|<%[!]? (?!.+?%>))\s*$"; foldingStopMarker = "(</[^?]+?>|[/%]>|-->)\s*$";
This is supposed to start folds on the following text: <!-- <%-- <% <%! <foo> ... but not if the line looks like this: <!-- --> <%-- --%> <% %> <%! %> <foo /> <foo></foo>
It's not exactly lightweight; I'd think I'd prefer to see a more flexible folding-marker system that would allow me to define pairs of start/end markers. That keep blocks like <!-- --%> from getting folded.
[1] http://telly.bravo5.org/svn/repos/TextMate/trunk/Bundles/XML.tmbundle/ Syntaxes/XML.plist
On Dec 4, 2004, at 12:13, Brian Lalor wrote:
It's not exactly lightweight; I'd think I'd prefer to see a more flexible folding-marker system that would allow me to define pairs of start/end markers. That keep blocks like <!-- --%> from getting folded.
Yes, I'm looking into that. The reason why only one set of patterns and indent was used mainly has to do with Ruby where you can e.g. have:
class foo def bar if something ... end end end
I.e. all “pairs” having identical end-marker. But it's not unlikely there'll just be a few “systems” to choose from in the future.