C# Class Microsoft.R.Editor.Tree.TreeUpdateTask

Asynchronous text change processing task
Inheritance: Microsoft.Languages.Editor.Tasks.CancellableTask
Show file Open project: Microsoft/RTVS Class Usage Examples

Private Properties

Property Type Description
ApplyBackgroundProcessingResults void
ApplyTreeChanges List
ClearChanges void
DeleteAndShiftElements bool
EnsureProcessingComplete void
OnIdle void
OnTextChanges void
ProcessChange void
ProcessComplexChange void
ProcessPendingTextBufferChanges void
ProcessPendingTextBufferChanges void
ProcessSimpleChange void
ProcessTextChanges void
Resume void
Suspend void
TakeThreadOwnership void
UpdateTreeTextSnapshot void

Public Methods

Method Description
TreeUpdateTask ( EditorTree editorTree, ICoreShell shell ) : System

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Private Methods

Method Description
ApplyBackgroundProcessingResults ( ) : void

Applies queued changes to the tree. Must only be called in a main thread context.

ApplyTreeChanges ( Microsoft.R.Editor.Tree.EditorTreeChangeCollection changesToApply ) : List
ClearChanges ( ) : void
DeleteAndShiftElements ( TextChangeContext context ) : bool
EnsureProcessingComplete ( ) : void

Makes sure all pending changes are processed and applied to the tree

OnIdle ( object sender, EventArgs e ) : void

Idle time event handler. Kicks background parsing if there are pending changes

OnTextChanges ( IReadOnlyCollection textChanges ) : void

Text buffer change event handler. Performs analysis of the change. If change is trivial, such as change in whitespace (excluding line breaks that in R may be sensistive), simply applies the changes by shifting tree elements. If some elements get deleted or otherwise damaged, removes them from the tree right away. Non-trivial changes are queued for background parsing which starts on next on idle. Methond must be called on a main thread only, typically from an event handler that receives text buffer change events.

ProcessChange ( TextChangeContext context ) : void
ProcessComplexChange ( TextChangeContext context ) : void

Handles non-trivial changes like changes that delete elements, change identifier names, introducing new braces: changes that cannot be handled without background parse.

ProcessPendingTextBufferChanges ( ITextProvider newTextProvider, bool async ) : void

Processes text buffer changed accumulated so far. Typically called on idle.

ProcessPendingTextBufferChanges ( bool async ) : void
ProcessSimpleChange ( TextChangeContext context ) : void

Handles simple (safe) changes.

ProcessTextChanges ( TextChange changeToProcess, bool async, Func isCancelledCallback ) : void

Main asyncronous task body

Resume ( ) : void

Resumes tree updates. If changes were made to the text buffer since suspend, full parse is performed.

Suspend ( ) : void

Suspend tree updates. Typically called before massive changes to the document.

TakeThreadOwnership ( ) : void
UpdateTreeTextSnapshot ( ) : void

Method Details

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

TreeUpdateTask() public method

public TreeUpdateTask ( EditorTree editorTree, ICoreShell shell ) : System
editorTree EditorTree
shell ICoreShell
return System