コード例 #1
0
        public void PreTab(out bool handledCommand)
        {
            bool handled = false;

            Debug.Assert(_postSession == null, "_postSession should have been cleared");

            // tab should only be handled by brace completion if there is no selection and both braces on the same line still
            if (_stack.TopSession != null && !HasSelection)
            {
                IBraceCompletionSession session = _stack.TopSession;

                _guardedOperations.CallExtensionPoint(() => {
                    if (IsSingleLine(session.OpeningPoint, session.ClosingPoint))
                    {
                        session.PreTab(out handled);

                        if (!handled)
                        {
                            _postSession = session;
                        }
                    }
                });
            }

            handledCommand = handled;
        }
コード例 #2
0
        internal void CheckTab(IBraceCompletionSession session, bool allowTab = true)
        {
            bool handled;
            session.PreTab(out handled);
            if (!handled)
            {
                session.PostTab();
            }

            var caret = session.TextView.GetCaretPoint(session.SubjectBuffer).Value;
            if (allowTab)
            {
                Assert.Equal(session.ClosingPoint.GetPosition(session.SubjectBuffer.CurrentSnapshot), caret.Position);
            }
            else
            {
                Assert.True(caret.Position < session.ClosingPoint.GetPosition(session.SubjectBuffer.CurrentSnapshot));
            }
        }
コード例 #3
0
        internal void CheckTab(IBraceCompletionSession session, bool allowTab = true)
        {
            bool handled;

            session.PreTab(out handled);
            if (!handled)
            {
                session.PostTab();
            }

            var caret = session.TextView.GetCaretPoint(session.SubjectBuffer).Value;

            if (allowTab)
            {
                Assert.Equal(session.ClosingPoint.GetPosition(session.SubjectBuffer.CurrentSnapshot), caret.Position);
            }
            else
            {
                Assert.True(caret.Position < session.ClosingPoint.GetPosition(session.SubjectBuffer.CurrentSnapshot));
            }
        }