Exemple #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);
        }
        public void Recalculate()
        {
            if (IsDismissed)
            {
                throw new InvalidOperationException();
            }
            bool firstTime = !IsStarted;

            IsStarted = true;
            if (firstTime && trackCaret)
            {
                TextView.Caret.PositionChanged += Caret_PositionChanged;
            }

            DisposeSignatureHelpSources();
            signatureHelpSources = CreateSignatureHelpSources();

            var list = new List <ISignature>();

            foreach (var source in signatureHelpSources)
            {
                source.AugmentSignatureHelpSession(this, list);
                if (IsDismissed)
                {
                    return;
                }
            }
            signatures.Clear();
            foreach (var sig in list)
            {
                signatures.Add(sig);
            }

            if (signatures.Count == 0)
            {
                Dismiss();
            }
            else
            {
                SelectedSignature = signatures[0];
                if (signatureHelpPresenter == null)
                {
                    signatureHelpPresenter = intellisensePresenterFactoryService.TryCreateIntellisensePresenter(this);
                    if (signatureHelpPresenter == null)
                    {
                        Dismiss();
                        return;
                    }
                    PresenterChanged?.Invoke(this, EventArgs.Empty);
                }
            }
            Recalculated?.Invoke(this, EventArgs.Empty);
        }
Exemple #3
0
        public void Start()
        {
            if (IsStarted)
            {
                throw new InvalidOperationException();
            }
            if (IsDismissed)
            {
                throw new InvalidOperationException();
            }
            IsStarted         = true;
            completionSources = CreateCompletionSources();

            var list = new List <CompletionSet>();

            foreach (var source in completionSources)
            {
                source.AugmentCompletionSession(this, list);
            }
            foreach (var cc in list)
            {
                completionSets.Add(cc);
            }

            if (completionSets.Count == 0)
            {
                Dismiss();
            }
            else
            {
                SelectedCompletionSet = completionSets[0];
                completionPresenter   = intellisensePresenterFactoryService.TryCreateIntellisensePresenter(this);
                if (completionPresenter == null)
                {
                    Dismiss();
                    return;
                }
                PresenterChanged?.Invoke(this, EventArgs.Empty);
                completionSessionCommandTargetFilter = new CompletionSessionCommandTargetFilter(this);
            }
        }