예제 #1
0
 public void IsDirectInput_Chars()
 {
     foreach (var cur in KeyInputUtilTest.CharsAll)
     {
         var input = KeyInputUtil.CharToKeyInput(cur);
         Assert.IsTrue(_mode.CanProcess(input));
         Assert.IsTrue(_mode.IsDirectInsert(input));
     }
 }
예제 #2
0
        /// <summary>
        /// Determine if the IInsertMode value should process the given KeyInput
        /// </summary>
        private bool ShouldProcessWithCommandTargetOverInsertMode(IInsertMode mode, KeyInput keyInput)
        {
            // In the middle of a word completion session let insert mode handle the input.  It's
            // displaying the intellisense itself and this method is meant to let custom intellisense
            // operate normally
            if (mode.ActiveWordCompletionSession.IsSome())
            {
                return(false);
            }

            // Don't let the mode directly process anything it considers direct input.  We need this to go
            // through IOleCommandTarget in order for features like intellisense to work properly
            if (mode.IsDirectInsert(keyInput))
            {
                return(true);
            }

            // Don't handle Enter or Tab in general as they are often very much special cased by the
            // language service
            if (keyInput == KeyInputUtil.EnterKey || keyInput.Key == VimKey.Tab)
            {
                return(true);
            }

            // Is this a key known to impact IntelliSense
            var isIntelliSenseKey =
                keyInput.Key == VimKey.Up ||
                keyInput.Key == VimKey.Down ||
                keyInput.Key == VimKey.Left ||
                keyInput.Key == VimKey.Right ||
                keyInput.Key == VimKey.Tab ||
                keyInput.Key == VimKey.Back ||
                keyInput == KeyInputUtil.EnterKey;

            // If this is any of the arrow keys and one of the help windows is active then don't
            // let insert mode process the input.  We want the KeyInput to be routed to the windows
            // like Intellisense so navigation can occur
            if (isIntelliSenseKey && (_broker.IsCompletionActive || _broker.IsQuickInfoActive || _broker.IsSignatureHelpActive || _broker.IsSmartTagSessionActive))
            {
                return(true);
            }

            // Unfortunately there is no way to detect if the R# completion windows are active.  We have
            // to take the pessimistic view that they are and just not handle the input
            if (isIntelliSenseKey && _externalEditManager.IsResharperInstalled)
            {
                return(true);
            }

            return(false);
        }
예제 #3
0
        /// <summary>
        /// Determine if the IInsertMode value should process the given KeyInput
        /// </summary>
        private bool ShouldProcessWithCommandTargetOverInsertMode(IInsertMode mode, KeyInput keyInput)
        {
            // In the middle of a word completion session let insert mode handle the input.  It's
            // displaying the intellisense itself and this method is meant to let custom intellisense
            // operate normally
            if (mode.ActiveWordCompletionSession.IsSome())
            {
                return false;
            }

            // Don't let the mode directly process anything it considers direct input.  We need this to go
            // through IOleCommandTarget in order for features like intellisense to work properly
            if (mode.IsDirectInsert(keyInput))
            {
                return true;
            }

            // Don't handle Enter or Tab in general as they are often very much special cased by the
            // language service
            if (keyInput == KeyInputUtil.EnterKey || keyInput.Key == VimKey.Tab)
            {
                return true;
            }

            // Is this a key known to impact IntelliSense
            var isIntelliSenseKey =
                keyInput.Key == VimKey.Up ||
                keyInput.Key == VimKey.Down ||
                keyInput.Key == VimKey.Left ||
                keyInput.Key == VimKey.Right ||
                keyInput.Key == VimKey.Tab ||
                keyInput.Key == VimKey.Back ||
                keyInput == KeyInputUtil.EnterKey;

            // If this is any of the arrow keys and one of the help windows is active then don't
            // let insert mode process the input.  We want the KeyInput to be routed to the windows
            // like Intellisense so navigation can occur
            if (isIntelliSenseKey && (_broker.IsCompletionActive || _broker.IsQuickInfoActive || _broker.IsSignatureHelpActive || _broker.IsSmartTagSessionActive))
            {
                return true;
            }

            // Unfortunately there is no way to detect if the R# completion windows are active.  We have
            // to take the pessimistic view that they are and just not handle the input
            if (isIntelliSenseKey && _externalEditManager.IsResharperInstalled)
            {
                return true;
            }

            return false;
        }
예제 #4
0
        /// <summary>
        /// Determine if the IInsertMode value should process the given KeyInput
        /// </summary>
        private bool CanProcessWithInsertMode(IInsertMode mode, KeyInput keyInput)
        {
            // Don't let the mode directly process anything it considers direct input.  We need this to go
            // through IOleCommandTarget in order for features like intellisense to work properly
            if (mode.IsDirectInsert(keyInput))
            {
                return false;
            }

            var isAnyArrow =
                keyInput.Key == VimKey.Up ||
                keyInput.Key == VimKey.Down ||
                keyInput.Key == VimKey.Left ||
                keyInput.Key == VimKey.Right;

            // If this is any of the arrow keys and one of the help windows is active then don't
            // let insert mode process the input.  We want the KeyInput to be routed to the windows
            // like Intellisense so navigation can occur
            if (isAnyArrow && (_broker.IsCompletionActive || _broker.IsQuickInfoActive || _broker.IsSignatureHelpActive || _broker.IsSmartTagSessionActive))
            {
                return false;
            }

            // Unfortunately there is no way to detect if the R# completion windows are active.  We have
            // to take the pessimistic view that they are and just not handle the input
            if (isAnyArrow && _externalEditManager.IsResharperInstalled)
            {
                return false;
            }

            return true;
        }