LLParser calls creation of node for every line change done

SyntaxEditor for WPF Forum

Posted 2 years ago by Kishan Narayan
Version: 21.1.0

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 years ago by Actipro Software Support - Cleveland, OH, USA


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 (v22.1.3) was released 21 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.