Ejemplo n.º 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);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
0
        public void Start()
        {
            if (IsStarted)
            {
                throw new InvalidOperationException();
            }
            if (IsDismissed)
            {
                throw new InvalidOperationException();
            }
            IsStarted = true;
            this.completionSources = CreateCompletionSources();

            var list = new List <CompletionCollection>();

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

            if (completionCollections.Count == 0)
            {
                Dismiss();
            }
            else
            {
                SelectedCompletionCollection = completionCollections[0];
                completionPresenter          = completionPresenterProvider.Create(this);
                Debug.Assert(completionPresenter != null);
                PresenterChanged?.Invoke(this, EventArgs.Empty);
                completionSessionCommandTargetFilter = new CompletionSessionCommandTargetFilter(this);
            }
        }