public void ComputeModel( ImmutableArray <ISignatureHelpProvider> providers, SignatureHelpTriggerInfo triggerInfo ) { AssertIsForeground(); var caretPosition = Controller.TextView.GetCaretPoint(Controller.SubjectBuffer).Value; var disconnectedBufferGraph = new DisconnectedBufferGraph( Controller.SubjectBuffer, Controller.TextView.TextBuffer ); // If we've already computed a model, then just use that. Otherwise, actually // compute a new model and send that along. Computation.ChainTaskAndNotifyControllerWhenFinished( (model, cancellationToken) => ComputeModelInBackgroundAsync( model, providers, caretPosition, disconnectedBufferGraph, triggerInfo, cancellationToken ) ); }
public void FilterModel( CompletionFilterReason filterReason, bool recheckCaretPosition = false, bool dismissIfEmptyAllowed = true, ImmutableDictionary <CompletionItemFilter, bool> filterState = null) { AssertIsForeground(); var caretPosition = GetCaretPointInViewBuffer(); // Use an interlocked increment so that reads by existing filter tasks will see the // change. Interlocked.Increment(ref _filterId); var localId = _filterId; Computation.ChainTaskAndNotifyControllerWhenFinished( model => { if (model != null && filterState != null) { // If the UI specified an updated filter state, then incorporate that // into our model. model = model.WithFilterState(filterState); } return(FilterModelInBackground( model, localId, caretPosition, recheckCaretPosition, dismissIfEmptyAllowed, filterReason)); }); }
public void ComputeModel( ImmutableArray <ISignatureHelpProvider> providers, SignatureHelpTriggerInfo triggerInfo) { AssertIsForeground(); var caretPosition = Controller.TextView.GetCaretPoint(Controller.SubjectBuffer).Value; var disconnectedBufferGraph = new DisconnectedBufferGraph(Controller.SubjectBuffer, Controller.TextView.TextBuffer); // If this is a retrigger command then update the retrigger-id. This way // any in-flight retrigger-updates will immediately bail out. if (IsNonTypeCharRetrigger(triggerInfo)) { Interlocked.Increment(ref _retriggerId); } var localId = _retriggerId; // If we've already computed a model, then just use that. Otherwise, actually // compute a new model and send that along. Computation.ChainTaskAndNotifyControllerWhenFinished( (model, cancellationToken) => ComputeModelInBackgroundAsync( localId, model, providers, caretPosition, disconnectedBufferGraph, triggerInfo, cancellationToken)); }
private void SetModelExplicitlySelectedItem(Func <Model, SignatureHelpItem> selector) { AssertIsForeground(); Computation.ChainTaskAndNotifyControllerWhenFinished( model => SetModelExplicitlySelectedItemInBackground(model, selector), updateController: false); }
private void SetModelSelectedItem(Func <Model, PresentationItem> selector) { AssertIsForeground(); Computation.ChainTaskAndNotifyControllerWhenFinished( model => SetModelSelectedItemInBackground(model, selector), updateController: false); }
private void SetModelExplicitlySelectedItem(Func <Model, SignatureHelpItem> selector) { this.Computation.ThreadingContext.ThrowIfNotOnUIThread(); Computation.ChainTaskAndNotifyControllerWhenFinished( model => SetModelExplicitlySelectedItemInBackground(model, selector), updateController: false); }
public void FilterModel(CompletionFilterReason filterReason, bool recheckCaretPosition = false, bool dismissIfEmptyAllowed = true) { AssertIsForeground(); var caretPosition = GetCaretPointInViewBuffer(); // Use an interlocked increment so that reads by existing filter tasks will see the // change. Interlocked.Increment(ref _filterId); var localId = _filterId; Computation.ChainTaskAndNotifyControllerWhenFinished(model => FilterModelInBackground(model, localId, caretPosition, recheckCaretPosition, dismissIfEmptyAllowed, filterReason)); }
public void FilterModel( CompletionFilterReason filterReason, ImmutableDictionary <CompletionItemFilter, bool> filterState) { AssertIsForeground(); var caretPosition = GetCaretPointInViewBuffer(); // Use an interlocked increment so that reads by existing filter tasks will see the // change. Interlocked.Increment(ref _filterId); var localId = _filterId; Computation.ChainTaskAndNotifyControllerWhenFinished( model => FilterModelInBackground( model, localId, caretPosition, filterReason, filterState)); }
public void IdentifyBestMatchAndFilterToAllItems(CompletionFilterReason filterReason, bool recheckCaretPosition = false, bool dismissIfEmptyAllowed = true) { AssertIsForeground(); var caretPosition = GetCaretPointInViewBuffer(); // Use an interlocked increment so that reads by existing filter tasks will see the // change. Interlocked.Increment(ref _filterId); var localId = _filterId; Computation.ChainTaskAndNotifyControllerWhenFinished(model => { var filteredModel = FilterModelInBackground(model, localId, caretPosition, recheckCaretPosition, dismissIfEmptyAllowed, filterReason); return(filteredModel != null ? filteredModel.WithFilteredItems(filteredModel.TotalItems).WithSelectedItem(filteredModel.SelectedItem) : null); }); }
internal void UpdateModelTrackingSpan(SnapshotPoint initialPosition) { AssertIsForeground(); var currentPosition = Controller.GetCaretPointInViewBuffer(); Computation.ChainTaskAndNotifyControllerWhenFinished( model => { if (model == null) { return(model); } // If our tracking point maps to the caret before the edit, it should also map to the // caret after the edit. This is for the automatic brace completion scenario where // we don't want the completion commit span to include the auto-inserted ')' if (model.CommitTrackingSpanEndPoint.GetPosition(initialPosition.Snapshot) == initialPosition.Position) { return(model.WithTrackingSpanEnd(currentPosition.Snapshot.Version.CreateTrackingPoint(currentPosition.Position, PointTrackingMode.Positive))); } return(model); }); }
public void SetModelBuilderState(bool includeBuilder) { AssertIsForeground(); Computation.ChainTaskAndNotifyControllerWhenFinished(model => SetModelBuilderStateInBackground(model, includeBuilder)); }
public void SetModelIsHardSelection(bool isHardSelection) { AssertIsForeground(); Computation.ChainTaskAndNotifyControllerWhenFinished(model => model?.WithHardSelection(isHardSelection)); }