How to run lexer.Tokenise() on line by line? #1036
-
|
I'm writing a toy editor, using chroma for coloring and giving the editor some understanding of what is beneath the cursor. For example: When the user presses a key, I would like to run lexer.Tokenise() on just the current line that is changed and provide the current start state of the line, IE is the line inside a multi-line comment etc. Can this be done with chroma? If yes, how? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
Thanks for the discussion, unfortunately this is not possible currently. |
Beta Was this translation helpful? Give feedback.
-
|
Ok. Thanks for a quick response. |
Beta Was this translation helpful? Give feedback.
-
|
I am also creating a code editor that utilizes chroma for code coloring. As long as you carefully run Tokenise() in a background routine, it actually performs quite well on an entire file of reasonable size. I am triggering Tokenise() with each content update in the background routine, and I abort previous processing requests when they overlap (just keep final). The primary issue is that Tokenise() cannot be cancelled once started. If a chunking version is not within scope, perhaps it would not be difficult to create a cancelable version of Tokenise()? This would provide the ability to abort a long running operation (large files), when you need to handle repeated content changes or quit the application gracefully. |
Beta Was this translation helpful? Give feedback.
Thanks for the discussion, unfortunately this is not possible currently.