Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [orion-dev] TextMate grammar performance

In theory the grammar engine is supposed to re-highlight only the damaged portion of a file, as determined by the grammar structure (the begin..end blocks). It sounds like you've found a bug that makes the engine do something really bad, like start from the top. The excessive time spent matching regexes is probably a side effect of it re-highlighting too much of the file.

For something more performant, you can try installing the CodeMirror plugin. It defers highlighting work to avoid hanging the UI (not a proper background thread, but close). As of an hour ago, it has COBOL support -- albeit not for embedded SQL.

The TextMate grammar engine has been problematic, and we're hoping to find a better solution for plugins to provide highlighting rules declaratively. Grant is doing some work in this area, so I'll let him comment. I would recommend trying CodeMirror/async approach, if that works for you, until Orion's declarative highlighting is beefed up.

On Wed, Nov 6, 2013 at 4:38 PM, Mike Kucera <mkucera@xxxxxxxxxx> wrote:

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?

Thanks!


Mike Kucera
Rational Developer for AIX and Linux
IBM Toronto Lab
mkucera@xxxxxxxxxx
 
 


Inactive hide details for Mark Macdonald ---11/05/2013 05:16:03 PM---Hi Mike Grammars in Orion currently do not allow hyperlinkMark 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




Hi Mike

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:
    {
      tagName: "a",
      attributes: {
        href: "
    http://example.org"
      }
      // 'start' and 'end' fields omitted.
      // Ranges produced by an async highlighter must be be bundled inside a
    StyleReadyEvent object -- see docs
    }

However I have not tested this.

Mark


On Tue, Nov 5, 2013 at 2:03 PM, Mike Kucera <mkucera@xxxxxxxxxx> wrote:
    Hi,

    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.


    Thanks.



Mike Kucera
Rational Developer for AIX and Linux
IBM Toronto Lab
mkucera@xxxxxxxxxx
 
 
_______________________________________________
orion-dev mailing list
orion-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/orion-dev


_______________________________________________
orion-dev mailing list
orion-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/orion-dev


GIF image

GIF image

GIF image


Back to the top