protected void Create(params string[] lines) { _textBuffer = EditorHost.CreateTextBuffer(lines); _asyncTaggerSource = new TestableAsyncTaggerSource(_textBuffer); _asyncTagger = new AsyncTagger <string, TextMarkerTag>(_asyncTaggerSource); _asyncTaggerInterface = _asyncTagger; }
internal static void WaitForBackgroundToComplete <TData, TTag>(this AsyncTagger <TData, TTag> asyncTagger, TestableSynchronizationContext synchronizationContext) where TTag : ITag { while (asyncTagger.AsyncBackgroundRequestData.HasValue) { synchronizationContext.RunAll(); Thread.Yield(); } }
public AsyncTest() { _textBuffer = CreateTextBuffer(); var classificationType = VimEditorHost.ClassificationTypeRegistryService.GetOrCreateClassificationType("classifier test"); _source = new TextAsyncTaggerSource <IClassificationTag>(new ClassificationTag(classificationType), _textBuffer); _asyncTagger = new AsyncTagger <Tuple <string, IClassificationTag>, IClassificationTag>(_source); _classifier = new Classifier(_asyncTagger); }
private void Create(params string[] lines) { _textBuffer = CreateTextBuffer(lines); // Setup a sychronization context we can control _synchronizationContext = new TestableSynchronizationContext(); _synchronizationContext.Install(); _asyncTaggerSource = new TestableAsyncTaggerSource(_textBuffer); _asyncTagger = new AsyncTagger <string, TextMarkerTag>(_asyncTaggerSource); _asyncTaggerInterface = _asyncTagger; }
internal AsyncTaggerType.AsyncBackgroundRequest CreateAsyncBackgroundRequest( SnapshotSpan span, CancellationTokenSource cancellationTokenSource, Task task = null) { var channel = new AsyncTagger <string, TextMarkerTag> .Channel(); channel.WriteNormal(SnapshotLineRange.CreateForSpan(span)); task = task ?? new Task(() => { }); return(new AsyncTaggerType.AsyncBackgroundRequest( span.Snapshot, channel, task, cancellationTokenSource)); }
protected ChannelTest() { _channel = new AsyncTagger<string, TextMarkerTag>.Channel(); }
protected override ITagger <TextMarkerTag> CreateTagger(ITextView textView) { _asyncTagger = CreateAsyncTagger(textView); return(_asyncTagger); }
protected ChannelTest() { _channel = new AsyncTagger <string, TextMarkerTag> .Channel(); }