/// <summary> /// Start a new ModelComputation. Completion computations and filtering tasks will be chained to this /// ModelComputation, and when the chain is complete the view will be notified via the /// OnCompletionModelUpdated handler. /// /// The latest immutable CompletionModel can be accessed at any time. Some parts of the code may choose /// to wait on it to arrive synchronously. /// /// Inspired by similar method in Completion/Controller.cs in Roslyn. /// </summary> void StartNewComputation( int position, CompletionRules rules, bool filterItems) { computation = new ModelComputation <CompletionModel> ( OnCompletionModelUpdated, Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion.PrioritizedTaskScheduler.AboveNormalInstance); ComputeModel(position); if (filterItems) { var document = compilationWorkspace.GetSubmissionDocument(sourceTextContent.Container); FilterModel(CompletionHelper.GetHelper(document)); } }
void StopComputation() { computation?.Stop(); computation = null; }