Beispiel #1
0
        /// <summary>
        /// Should this be skipped when removing conflicting bindings?
        /// </summary>
        internal static bool ShouldSkip(CommandKeyBinding binding)
        {
            if (!IsImportantScope(binding.KeyBinding.Scope))
            {
                return(true);
            }

            if (!binding.KeyBinding.KeyStrokes.Any())
            {
                return(true);
            }

            var first = binding.KeyBinding.FirstKeyStroke;

            // We don't want to remove any mappings which don't include a modifier key
            // because it removes too many mappings.  Without this check we would for
            // example remove Delete in insert mode, arrow keys for intellisense and
            // general navigation, space bar for completion, etc ...
            if (first.KeyModifiers == KeyModifiers.None)
            {
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        /// <summary>
        /// Should this be skipped when removing conflicting bindings?
        /// </summary>
        internal static bool ShouldSkip(CommandKeyBinding binding)
        {
            if (!IsImportantScope(binding.KeyBinding.Scope))
            {
                return true;
            }

            if (!binding.KeyBinding.KeyStrokes.Any())
            {
                return true;
            }

            var first = binding.KeyBinding.FirstKeyStroke;

            // We don't want to remove any mappings which don't include a modifier key
            // because it removes too many mappings.  Without this check we would for
            // example remove Delete in insert mode, arrow keys for intellisense and
            // general navigation, space bar for completion, etc ...
            if (first.KeyModifiers == KeyModifiers.None)
            {
                return true;
            }

            return false;
        }
Beispiel #3
0
 public void Ctor1()
 {
     var binding = KeyBinding.Parse("Global::Ctrl+Left Arrow");
     var command = new CommandKeyBinding(new CommandId(), "Foo", binding);
     var data = new KeyBindingData(new CommandKeyBinding[] { command });
     Assert.Equal("Ctrl+Left Arrow", data.KeyName);
     Assert.False(data.HandledByVsVim);
 }
        /// <summary>
        /// Is the specified command active with the given binding
        /// </summary>
        public bool IsActive(CommandKeyBinding commandKeyBinding)
        {
            CommandData commandData;
            if (!_commandMap.TryGetValue(commandKeyBinding.Id, out commandData))
            {
                return false;
            }

            return commandData.CommandKeyBindings.Contains(commandKeyBinding);
        }
        /// <summary>
        /// Is the specified command active with the given binding
        /// </summary>
        public bool IsActive(CommandKeyBinding commandKeyBinding)
        {
            CommandData commandData;

            if (!_commandMap.TryGetValue(commandKeyBinding.Id, out commandData))
            {
                return(false);
            }

            return(commandData.CommandKeyBindings.Contains(commandKeyBinding));
        }
Beispiel #6
0
        /// <summary>
        /// Should this be skipped when removing conflicting bindings?
        /// </summary>
        public static bool ShouldSkip(CommandKeyBinding binding)
        {
            if (!IsImportantScope(binding.KeyBinding.Scope))
            {
                return true;
            }

            if (!binding.KeyBinding.KeyInputs.Any())
            {
                return true;
            }

            var first = binding.KeyBinding.FirstKeyInput;

            // Don't want to remove the arrow key bindings because it breaks items like
            // moving in the intellisense window
            if (first.IsArrowKey)
            {
                return true;
            }

            return false;
        }
Beispiel #7
0
        /// <summary>
        /// Should this be skipped when removing conflicting bindings?
        /// </summary>
        internal bool ShouldSkip(CommandKeyBinding binding)
        {
            var scope = binding.KeyBinding.Scope;
            if (!_importantScopeSet.Contains(scope))
            {
                return true;
            }

            if (!binding.KeyBinding.KeyStrokes.Any())
            {
                return true;
            }

            var first = binding.KeyBinding.FirstKeyStroke;

            // We don't want to remove any mappings which don't include a modifier key
            // because it removes too many mappings.  Without this check we would for
            // example remove Delete in insert mode, arrow keys for intellisense and
            // general navigation, space bar for completion, etc ...
            //
            // One exception is function keys.  They are only bound in Vim to key
            // mappings and should win over VS commands since users explicitly
            // want them to occur
            if (first.KeyModifiers == KeyModifiers.None && !first.KeyInput.IsFunctionKey)
            {
                return true;
            }

            return false;
        }