public static void DoTriggerCompletion(IntellisenseController controller, CompletionInfoType infoType, bool signatureHelpOnly, IntellisenseInvocationType invocationType)
        {
            Contract.Requires <ArgumentNullException>(controller != null, "controller");

            var           completionInfo = controller.CompletionInfo;
            ITextView     textView       = controller.TextView;
            SnapshotPoint?point          = textView.Caret.Position.Point.GetPoint(textView.TextBuffer, PositionAffinity.Predecessor);

            if (point.HasValue)
            {
                ITrackingPoint trackingPoint = textView.TextBuffer.CurrentSnapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);
                if (!signatureHelpOnly)
                {
                    controller.TriggerCompletion(trackingPoint, infoType, invocationType);
                    DoCallMatch(controller);
                }

                if (signatureHelpOnly /*|| (completionInfo.CompletionFlags & CompletionFlags.HasParameterInfo) != 0*/)
                {
                    controller.TriggerSignatureHelp(trackingPoint);
                }

                if (controller.CompletionSession != null)
                {
                    controller.IntellisenseSessionStack.MoveSessionToTop(controller.CompletionSession);
                }
            }
        }
        protected virtual bool DismissAllCompletionSessions()
        {
            IntellisenseController controller = Controller;

            if (controller == null)
            {
                return(false);
            }

            IIntellisenseSessionStack sessionStack = controller.IntellisenseSessionStack;

            if (sessionStack == null)
            {
                return(false);
            }

            ReadOnlyCollection <IIntellisenseSession> sessions = sessionStack.Sessions;

            if (sessions == null)
            {
                return(false);
            }

            List <ICompletionSession> completionSessions = new List <ICompletionSession>(sessions.OfType <ICompletionSession>());

            foreach (var session in completionSessions)
            {
                session.Dismiss();
            }

            return(completionSessions.Count > 0);
        }
        public static void DoTriggerCompletion(IntellisenseController controller, CompletionInfoType infoType, bool signatureHelpOnly, IntellisenseInvocationType invocationType)
        {
            Contract.Requires<ArgumentNullException>(controller != null, "controller");

            var completionInfo = controller.CompletionInfo;
            ITextView textView = controller.TextView;
            SnapshotPoint? point = textView.Caret.Position.Point.GetPoint(textView.TextBuffer, PositionAffinity.Predecessor);
            if (point.HasValue)
            {
                ITrackingPoint trackingPoint = textView.TextBuffer.CurrentSnapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);
                if (!signatureHelpOnly)
                {
                    controller.TriggerCompletion(trackingPoint, infoType, invocationType);
                    DoCallMatch(controller);
                }

                if (signatureHelpOnly /*|| (completionInfo.CompletionFlags & CompletionFlags.HasParameterInfo) != 0*/)
                {
                    controller.TriggerSignatureHelp(trackingPoint);
                }

                if (controller.CompletionSession != null)
                {
                    controller.IntellisenseSessionStack.MoveSessionToTop(controller.CompletionSession);
                }
            }
        }
        protected virtual bool AnySignatureHelpSessions()
        {
            IntellisenseController controller = Controller;

            if (controller == null)
            {
                return(false);
            }

            IIntellisenseSessionStack sessionStack = controller.IntellisenseSessionStack;

            if (sessionStack == null)
            {
                return(false);
            }

            ReadOnlyCollection <IIntellisenseSession> sessions = sessionStack.Sessions;

            if (sessions == null)
            {
                return(false);
            }

            return(sessions.OfType <ISignatureHelpSession>().Any());
        }
        public IntellisenseCommandFilter(IVsTextView textViewAdapter, IntellisenseController controller)
            : base(textViewAdapter)
        {
            Contract.Requires(textViewAdapter != null);
            Contract.Requires <ArgumentNullException>(controller != null, "controller");

            _controller = controller;
        }
        public IntellisenseCommandFilter([NotNull] IVsTextView textViewAdapter, [NotNull] IntellisenseController controller)
            : base(textViewAdapter)
        {
            Debug.Assert(textViewAdapter != null);
            Requires.NotNull(controller, nameof(controller));

            _controller = controller;
        }
        protected virtual IntellisenseController TryCreateIntellisenseController(ITextView textView, IList<ITextBuffer> subjectBuffers)
        {
            Contract.Requires<ArgumentNullException>(textView != null, "textView");
            Contract.Requires<ArgumentNullException>(subjectBuffers != null, "subjectBuffers");

            IntellisenseController controller = new IntellisenseController(textView, this);
            return controller;
        }
        public IntellisenseCommandFilter(IVsTextView textViewAdapter, IntellisenseController controller)
            : base(textViewAdapter)
        {
            Contract.Requires(textViewAdapter != null);
            Contract.Requires<ArgumentNullException>(controller != null, "controller");

            _controller = controller;
        }
Esempio n. 9
0
        protected virtual IntellisenseController TryCreateIntellisenseController([NotNull] ITextView textView, [NotNull] IList <ITextBuffer> subjectBuffers)
        {
            Requires.NotNull(textView, nameof(textView));
            Requires.NotNull(subjectBuffers, nameof(subjectBuffers));

            IntellisenseController controller = new IntellisenseController(textView, this);

            return(controller);
        }
Esempio n. 10
0
        protected virtual IntellisenseController TryCreateIntellisenseController(ITextView textView, IList <ITextBuffer> subjectBuffers)
        {
            Contract.Requires <ArgumentNullException>(textView != null, "textView");
            Contract.Requires <ArgumentNullException>(subjectBuffers != null, "subjectBuffers");

            IntellisenseController controller = new IntellisenseController(textView, this);

            return(controller);
        }
Esempio n. 11
0
        IIntellisenseController IIntellisenseControllerProvider.TryCreateIntellisenseController(ITextView textView, IList <ITextBuffer> subjectBuffers)
        {
            IntellisenseController controller = TryCreateIntellisenseController(textView, subjectBuffers);

            if (controller != null)
            {
                List <ITvlIntellisenseController> controllers = textView.Properties.GetOrCreateSingletonProperty <List <ITvlIntellisenseController> >(typeof(ITvlIntellisenseController), () => new List <ITvlIntellisenseController>());
                controllers.Add(controller);
            }

            return(controller);
        }
Esempio n. 12
0
        public static bool IsCompletionPresenterActive([NotNull] IntellisenseController controller, bool evenIfUsingDefaultPresenter)
        {
            Requires.NotNull(controller, nameof(controller));

            if (controller.Provider.CompletionBroker == null || controller.CompletionSession == null || controller.CompletionSession.IsDismissed)
            {
                return(false);
            }

            //if (!evenIfUsingDefaultPresenter && HostableEditor._useDefaultPresenter)
            //    return false;

            if (controller.Provider.CompletionBroker.IsCompletionActive(controller.TextView))
            {
                return(true);
            }

            if (controller.Provider.SignatureHelpBroker == null)
            {
                return(false);
            }

            return(controller.Provider.SignatureHelpBroker.IsSignatureHelpActive(controller.TextView));
        }
        public static bool IsCompletionPresenterActive(IntellisenseController controller, bool evenIfUsingDefaultPresenter)
        {
            Contract.Requires <ArgumentNullException>(controller != null, "controller");

            if (controller.Provider.CompletionBroker == null || controller.CompletionSession == null || controller.CompletionSession.IsDismissed)
            {
                return(false);
            }

            //if (!evenIfUsingDefaultPresenter && HostableEditor._useDefaultPresenter)
            //    return false;

            if (controller.Provider.CompletionBroker.IsCompletionActive(controller.TextView))
            {
                return(true);
            }

            if (controller.Provider.SignatureHelpBroker == null)
            {
                return(false);
            }

            return(controller.Provider.SignatureHelpBroker.IsSignatureHelpActive(controller.TextView));
        }
Esempio n. 14
0
        public CompletionInfo(IntellisenseController controller)
        {
            Contract.Requires<ArgumentNullException>(controller != null, "controller");

            _controller = controller;
        }
        public static bool DoCallMatch(IntellisenseController completionTarget)
        {
            Contract.Requires<ArgumentNullException>(completionTarget != null, "completionTarget");

#if true
            return false;
#else
            bool flag2 = false;
            ICompletionSession session = completionTarget.CompletionSession;
            if (session != null)
            {
                ITextSnapshot snapshot = session.TextView.TextSnapshot;
                string text = snapshot.GetText(completionTarget.CompletionInfo.ApplicableTo.GetSpan(snapshot));
                if (string.IsNullOrEmpty(text))
                    return false;

                session.Match();
                CompletionSet set1 = null;
                CompletionSet set2 = null;
                CompletionSet set3 = null;
                CompletionSet set4 = null;
                bool flag3 = false;
                bool flag4 = false;
                foreach (CompletionSet set in session.CompletionSets.Where(i => i != null && i.SelectionStatus != null && i.SelectionStatus.Completion != null))
                {
                    flag2 = true;
                    bool isAllTab = false;
                    if (isAllTab)
                    {
                        set3 = set;
                        flag3 = string.Equals(text, set.SelectionStatus.Completion.DisplayText, StringComparison.CurrentCultureIgnoreCase);
                    }
                    else
                    {
                        set4 = set;
                        flag4 = string.Equals(text, set.SelectionStatus.Completion.DisplayText, StringComparison.CurrentCultureIgnoreCase);
                    }
                }

                if (flag3 && !flag4)
                {
                    set1 = set3;
                }
                else if (set2 != null)
                {
                    if (set2 != set3 && set4 == null)
                        set1 = set3;
                }
                else if (set4 != null)
                {
                    set1 = set4;
                }
                else
                {
                    set1 = set3;
                }

                if (set1 != null)
                {
                    session.SelectedCompletionSet = set1;
                }
            }

            return flag2;
#endif
        }
        public static bool IsCompletionPresenterActive(IntellisenseController controller, bool evenIfUsingDefaultPresenter)
        {
            Contract.Requires<ArgumentNullException>(controller != null, "controller");

            if (controller.Provider.CompletionBroker == null || controller.CompletionSession == null || controller.CompletionSession.IsDismissed)
                return false;

            //if (!evenIfUsingDefaultPresenter && HostableEditor._useDefaultPresenter)
            //    return false;

            if (controller.Provider.CompletionBroker.IsCompletionActive(controller.TextView))
                return true;

            if (controller.Provider.SignatureHelpBroker == null)
                return false;

            return controller.Provider.SignatureHelpBroker.IsSignatureHelpActive(controller.TextView);
        }
        public static bool DoCallMatch(IntellisenseController completionTarget)
        {
            Contract.Requires <ArgumentNullException>(completionTarget != null, "completionTarget");

#if true
            return(false);
#else
            bool flag2 = false;
            ICompletionSession session = completionTarget.CompletionSession;
            if (session != null)
            {
                ITextSnapshot snapshot = session.TextView.TextSnapshot;
                string        text     = snapshot.GetText(completionTarget.CompletionInfo.ApplicableTo.GetSpan(snapshot));
                if (string.IsNullOrEmpty(text))
                {
                    return(false);
                }

                session.Match();
                CompletionSet set1  = null;
                CompletionSet set2  = null;
                CompletionSet set3  = null;
                CompletionSet set4  = null;
                bool          flag3 = false;
                bool          flag4 = false;
                foreach (CompletionSet set in session.CompletionSets.Where(i => i != null && i.SelectionStatus != null && i.SelectionStatus.Completion != null))
                {
                    flag2 = true;
                    bool isAllTab = false;
                    if (isAllTab)
                    {
                        set3  = set;
                        flag3 = string.Equals(text, set.SelectionStatus.Completion.DisplayText, StringComparison.CurrentCultureIgnoreCase);
                    }
                    else
                    {
                        set4  = set;
                        flag4 = string.Equals(text, set.SelectionStatus.Completion.DisplayText, StringComparison.CurrentCultureIgnoreCase);
                    }
                }

                if (flag3 && !flag4)
                {
                    set1 = set3;
                }
                else if (set2 != null)
                {
                    if (set2 != set3 && set4 == null)
                    {
                        set1 = set3;
                    }
                }
                else if (set4 != null)
                {
                    set1 = set4;
                }
                else
                {
                    set1 = set3;
                }

                if (set1 != null)
                {
                    session.SelectedCompletionSet = set1;
                }
            }

            return(flag2);
#endif
        }
Esempio n. 18
0
        public CompletionInfo(IntellisenseController controller)
        {
            Contract.Requires <ArgumentNullException>(controller != null, "controller");

            _controller = controller;
        }
Esempio n. 19
0
        public CompletionInfo([NotNull] IntellisenseController controller)
        {
            Requires.NotNull(controller, nameof(controller));

            _controller = controller;
        }