Microsoft.R.Editor.Tree.TreeUpdateTask.ProcessPendingTextBufferChanges C# (CSharp) Method

ProcessPendingTextBufferChanges() private method

Processes text buffer changed accumulated so far. Typically called on idle.
private ProcessPendingTextBufferChanges ( ITextProvider newTextProvider, bool async ) : void
newTextProvider ITextProvider New text buffer content
async bool True if processing is to be done asynchronously. /// Non-async processing is typically used in unit tests only.
return void
        internal void ProcessPendingTextBufferChanges(ITextProvider newTextProvider, bool async) {
            if (Thread.CurrentThread.ManagedThreadId != _ownerThreadId)
                throw new ThreadStateException("Method should only be called on the main thread");

            if (ChangesPending) {
                if (async && (IsTaskRunning() || _backgroundParsingResults.Count > 0)) {
                    // Try next time or we may end up spawning a lot of tasks
                    return;
                }

                // Combine changes in processing with pending changes.
                var changesToProcess = new TextChange(_pendingChanges, newTextProvider);

                // We need to signal task start here, in the main thread since it takes
                // some time before task is created and when it actually starts.
                // Therefore setting task state in the task body creates a gap
                // where we may end up spawning another task.

                base.Run((isCancelledCallback) => ProcessTextChanges(changesToProcess, async, isCancelledCallback), async);
            }
        }

Same methods

TreeUpdateTask::ProcessPendingTextBufferChanges ( bool async ) : void

Usage Example

Example #1
0
 /// <summary>
 /// Initiates processing of pending changes synchronously.
 /// </summary>
 internal void ProcessChanges()
 {
     if (this.IsDirty)
     {
         TreeUpdateTask.ProcessPendingTextBufferChanges(false);
     }
 }
All Usage Examples Of Microsoft.R.Editor.Tree.TreeUpdateTask::ProcessPendingTextBufferChanges