[orion-dev] TextMate grammar performance
Thanks for the help with the links. I just wanted to make sure it would be possible to do hyperlinking.
I'm exploring the grammar approach for highlighting cobol because I think it should be easier to handle context sensitivity. Cobol has things like positional keywords, for example SQL keywords should only get highlighted inside of embedded SQL statements.
I have started with a very simple grammar that just matches keywords, strings, numbers and comment blocks. We have a 16,000 line cobol file we use for performance testing. When I use my grammar with this file the editor performance slows down considerably. Whey I type something into the editor it can sometimes take several seconds for what I typed to appear. The performance is much worse when I type something at the top of the file than at the bottom. It seems to want to parse the file from where the cursor is all the way to the bottom.
There's at least three issues here...
- A lot of the time is spent matching regular expressions (according to Chrome dev tools). I'm not sure if there's any way to optimize this.
- It seems to want to parse the whole file below the cursor. From looking at the source for TextMateStyler it seems like there should be a way to get it to only parse a region of the file, but I don't know how to do that.
- The editor runs the styler on every keystroke. If I quickly type 5 characters it calls the styler 5 times. In the regular eclipse editor a background reconciler thread keeps a timer that is reset to zero on every keystroke, and the repair event is only fired after the user has stopped typing for a bit. Can something like that be done in Orion?
Mark Macdonald ---11/05/2013 05:16:03 PM---Hi Mike Grammars in Orion currently do not allow hyperlinks to be generated, only
From: Mark Macdonald <mamacdon@xxxxxxxxx>
To: Orion developer discussions <orion-dev@xxxxxxxxxxx>
Date: 11/05/2013 05:16 PM
Subject: Re: [orion-dev] TextMate grammar and hyperlinks
Sent by: orion-dev-bounces@xxxxxxxxxxx
|Rational Developer for AIX and Linux|
|IBM Toronto Lab|
Grammars in Orion currently do not allow hyperlinks to be generated, only CSS class names (which are derived from the grammar's "name" rules).
I believe hyperlinks could be contributed by writing an async highlight provider that produces the appropriate style ranges. A range having this shape would probably work:
However I have not tested this.
// 'start' and 'end' fields omitted.
// Ranges produced by an async highlighter must be be bundled inside a StyleReadyEvent object -- see docs
On Tue, Nov 5, 2013 at 2:03 PM, Mike Kucera <mkucera@xxxxxxxxxx> wrote:
I'm working on a COBOL grammar for use with the orion.editor.TextMateStyler and I have one question: how do I create ctrl-click hyperlinks? I think I need to somehow attach a 'href' attribute to the style object but I don't know how to do that from the grammar.
orion-dev mailing list