static void WaitForAnalysis(ReplWindowProxy interactive) { var stopAt = DateTime.Now.Add(TimeSpan.FromSeconds(60)); interactive.TextView.GetAnalyzer(interactive.App.ServiceProvider).WaitForCompleteAnalysis(_ => DateTime.Now < stopAt); if (DateTime.Now >= stopAt) { Assert.Fail("Timeout waiting for complete analysis"); } // Most of the time we're waiting to ensure that IntelliSense will // work, which normally requires a bit more time. Thread.Sleep(500); }
static void EnsureInputFunction(ReplWindowProxy interactive) { var settings = (PythonReplWindowProxySettings)interactive.Settings; if (settings.RawInput != "input") { interactive.SubmitCode("input = " + settings.RawInput); interactive.ClearScreen(); } }
internal static IMappingTagSpan<IntraTextAdornmentTag>[] WaitForTags(ReplWindowProxy interactive) { var aggFact = interactive.App.ComponentModel.GetService<IViewTagAggregatorFactoryService>(); var textView = interactive.TextView; var aggregator = aggFact.CreateTagAggregator<IntraTextAdornmentTag>(textView); var snapshot = textView.TextBuffer.CurrentSnapshot; IMappingTagSpan<IntraTextAdornmentTag>[] tags = null; ((UIElement)textView).Dispatcher.Invoke((Action)(() => { for (int i = 0; i < 100; i++) { tags = aggregator.GetTags(new SnapshotSpan(snapshot, new Span(0, snapshot.Length))).ToArray(); if (tags.Length > 0) { break; } Thread.Sleep(100); } })); Assert.IsNotNull(tags, "Unable to find tags"); return tags; }
internal static void AssertContainingRegion(ReplWindowProxy interactive, int position, string expectedText) { SnapshotSpan? span = interactive.GetContainingRegion( new SnapshotPoint(interactive.TextView.TextBuffer.CurrentSnapshot, position) ); Assert.IsNotNull(span); Assert.AreEqual(expectedText, span.Value.GetText()); }
public StepState(ReplWindowProxy interactive, PythonVisualStudioApp app, EditorWindow editor, EnvDTE.Window window) { Interactive = interactive; App = app; Editor = editor; Window = window; Content = new StringBuilder(); }