LLParser calls creation of node for every line change done

SyntaxEditor for WPF Forum

Posted 2 months ago by Kishan Narayan
Version: 21.1.0
Avatar

How do one avoid parsing of entire document when one just inserts or updates a line via code below

ITextChange change =                          document.CreateTextChange(TextChangeTypes.Replace, textChangeOption);
change.ReplaceText(EditorView.Selection.TextRange, newText);
var result = change.Apply();

This calls ParseCore for entire snapshot which is time consuming in case one has a big text file loaded

Comments (1)

Posted 2 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Yes it will parse the entire document on a text change because even a small text change could affect the entire document, such as typing "/*" in C#.

That being said, make sure you have the AmbientParseRequestDispatcher initialized per this documentation.  That will allow the parser to run in a background thread and will therefore not affect editing performance.  If you do sequential typing, it will cancel any pending parse jobs that haven't yet run too as it adds a new parse request.


Actipro Software Support

The latest build of this product (v21.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.