Example #1
0
        private async void TextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            if (_quickInfoSession != null && !_quickInfoSession.IsDismissed)
            {
                _quickInfoSession.Dismiss();
            }
            var pt = e.TextPosition.GetPoint(EditorExtensions.IsPythonContent, PositionAffinity.Successor);

            if (pt != null)
            {
                var quickInfo = await VsProjectAnalyzer.GetQuickInfoAsync(pt.Value);

                QuickInfoSource.AddQuickInfo(_textView.TextBuffer, quickInfo);

                _quickInfoSession = _provider._QuickInfoBroker.TriggerQuickInfo(
                    _textView,
                    pt.Value.Snapshot.CreateTrackingPoint(pt.Value.Position, PointTrackingMode.Positive),
                    true
                    );
            }
        }
Example #2
0
        private static void TestQuickInfo(PythonEditor view, int start, int end, params string[] expected)
        {
            var snapshot = view.CurrentSnapshot;

            for (int i = start; i < end; i++)
            {
                List <object> quickInfo = new List <object>();
                ITrackingSpan span;
                QuickInfoSource.AugmentQuickInfoWorker(
                    quickInfo,
                    VsProjectAnalyzer.GetQuickInfoAsync(
                        new SnapshotPoint(snapshot, start)
                        ).Result,
                    out span
                    );

                Assert.AreEqual(expected.Length, quickInfo.Count);
                for (int j = 0; j < expected.Length; j++)
                {
                    Assert.AreEqual(expected[j], quickInfo[j]);
                }
            }
        }