示例#1
0
        public void Recalculate()
        {
            if (IsDismissed)
            {
                throw new InvalidOperationException();
            }
            IsStarted = true;

            DisposeQuickInfoSources();
            quickInfoSources = CreateQuickInfoSources();

            var           newContent       = new List <object>();
            ITrackingSpan applicableToSpan = null;

            foreach (var source in quickInfoSources)
            {
                ITrackingSpan applicableToSpanTmp;
                source.AugmentQuickInfoSession(this, newContent, out applicableToSpanTmp);
                if (IsDismissed)
                {
                    return;
                }
                if (applicableToSpan == null)
                {
                    applicableToSpan = applicableToSpanTmp;
                }
            }

            if (newContent.Count == 0 || applicableToSpan == null)
            {
                Dismiss();
            }
            else
            {
                QuickInfoContent.BeginBulkOperation();
                QuickInfoContent.Clear();
                QuickInfoContent.AddRange(newContent);
                QuickInfoContent.EndBulkOperation();

                HasInteractiveContent = CalculateHasInteractiveContent();
                ApplicableToSpan      = applicableToSpan;
                if (quickInfoPresenter == null)
                {
                    quickInfoPresenter = intellisensePresenterFactoryService.TryCreateIntellisensePresenter(this);
                    if (quickInfoPresenter == null)
                    {
                        Dismiss();
                        return;
                    }
                    PresenterChanged?.Invoke(this, EventArgs.Empty);
                }
            }
            Recalculated?.Invoke(this, EventArgs.Empty);
        }
示例#2
0
        public void Recalculate()
        {
            if (IsDismissed)
            {
                throw new InvalidOperationException();
            }
            IsStarted = true;

            DisposeQuickInfoSources();
            quickInfoSources = CreateQuickInfoSources();

            QuickInfoContent.Clear();
            ITrackingSpan applicableToSpan = null;

            foreach (var source in quickInfoSources)
            {
                ITrackingSpan applicableToSpanTmp;
                source.AugmentQuickInfoSession(this, QuickInfoContent, out applicableToSpanTmp);
                if (applicableToSpan == null)
                {
                    applicableToSpan = applicableToSpanTmp;
                }
            }

            if (QuickInfoContent.Count == 0 || applicableToSpan == null)
            {
                Dismiss();
            }
            else
            {
                HasInteractiveContent = CalculateHasInteractiveContent();
                ApplicableToSpan      = applicableToSpan;
                if (quickInfoPresenter == null)
                {
                    quickInfoPresenter = quickInfoPresenterProvider.Create(this);
                    Debug.Assert(quickInfoPresenter != null);
                    PresenterChanged?.Invoke(this, EventArgs.Empty);
                }
            }

            Recalculated?.Invoke(this, EventArgs.Empty);
        }