Esempio n. 1
0
        public void RunConflictingKeyBindingStateCheck(IEnumerable <KeyInput> neededInputs, Action <ConflictingKeyBindingState, CommandKeyBindingSnapshot> onComplete)
        {
            if (_snapshot != null)
            {
                onComplete(_state, _snapshot);
                return;
            }

            var util = new KeyBindingUtil(_dte);
            var set  = new HashSet <KeyInput>(neededInputs);

            _snapshot = util.CreateCommandKeyBindingSnapshot(set);
            ConflictingKeyBindingState = _snapshot.Conflicting.Any()
                ? ConflictingKeyBindingState.FoundConflicts
                : ConflictingKeyBindingState.ConflictsIgnoredOrResolved;
        }
Esempio n. 2
0
        public void FindRemovedKeyBindings1()
        {
            global::VsVim.Settings.Settings.Default.HaveUpdatedKeyBindings = true;
            global::VsVim.Settings.Settings.Default.RemovedBindings        = new CommandBindingSetting[] {
                new CommandBindingSetting()
                {
                    Name = "foo", CommandString = "Scope::Ctrl+J"
                },
                new CommandBindingSetting()
                {
                    Name = "bar", CommandString = "Scope::Ctrl+J"
                }
            };
            var list = KeyBindingUtil.FindKeyBindingsMarkedAsRemoved();

            Assert.AreEqual(2, list.Count);
            Assert.AreEqual("foo", list[0].Name);
            Assert.AreEqual("bar", list[1].Name);
        }
Esempio n. 3
0
 public void ShowDialog(IVimBuffer buffer)
 {
     try
     {
         var util     = new KeyBindingUtil(_dte);
         var snapshot = util.CreateCommandKeyBindingSnapshot(buffer);
         new UI.ConflictingKeyBindingDialog(snapshot).ShowDialog();
     }
     catch (Exception)
     {
         // When dogfooding VsVim there is a bug in Visual Studio which causes the
         // VsVim DLL to be loaded twice (once for VsVim and once for the Settings
         // and associated designers).  This causes WPF to error when loading the dialog
         // resources and an unhandled exception occurs.
         VsShellUtilities.ShowMessageBox(
             _serviceProvider,
             "Error displaying options page",
             "Error",
             OLEMSGICON.OLEMSGICON_WARNING,
             OLEMSGBUTTON.OLEMSGBUTTON_OK,
             OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
     }
 }
Esempio n. 4
0
 public void ShowDialog(IVimBuffer buffer)
 {
     try
     {
         var util = new KeyBindingUtil(_dte);
         var snapshot = util.CreateCommandKeyBindingSnapshot(buffer);
         new UI.ConflictingKeyBindingDialog(snapshot).ShowDialog();
     }
     catch (Exception)
     {
         // When dogfooding VsVim there is a bug in Visual Studio which causes the
         // VsVim DLL to be loaded twice (once for VsVim and once for the Settings
         // and associated designers).  This causes WPF to error when loading the dialog
         // resources and an unhandled exception occurs.
         VsShellUtilities.ShowMessageBox(
             _serviceProvider,
             "Error displaying options page",
             "Error",
             OLEMSGICON.OLEMSGICON_WARNING,
             OLEMSGBUTTON.OLEMSGBUTTON_OK,
             OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
     }
 }
Esempio n. 5
0
        public void ShouldSkip1()
        {
            var binding = CreateCommandKeyBinding(KeyInputUtil.VimKeyToKeyInput(VimKey.Left));

            Assert.IsTrue(KeyBindingUtil.ShouldSkip(binding));
        }
Esempio n. 6
0
 public void IsImportantScope2()
 {
     Assert.IsFalse(KeyBindingUtil.IsImportantScope("blah"));
     Assert.IsFalse(KeyBindingUtil.IsImportantScope("VC Image Editor"));
 }
Esempio n. 7
0
 public void IsImportantScope1()
 {
     Assert.IsTrue(KeyBindingUtil.IsImportantScope("Global"));
     Assert.IsTrue(KeyBindingUtil.IsImportantScope("Text Editor"));
     Assert.IsTrue(KeyBindingUtil.IsImportantScope(String.Empty));
 }
Esempio n. 8
0
        internal void RunConflictingKeyBindingStateCheck(IEnumerable<KeyInput> neededInputs, Action<ConflictingKeyBindingState, CommandKeyBindingSnapshot> onComplete)
        {
            if (_snapshot != null)
            {
                onComplete(_state, _snapshot);
                return;
            }

            var util = new KeyBindingUtil(_dte, GetOrCreateImportantScopeSet());
            var set = new HashSet<KeyInput>(neededInputs);
            _snapshot = util.CreateCommandKeyBindingSnapshot(set);
            ConflictingKeyBindingState = _snapshot.Conflicting.Any()
                ? ConflictingKeyBindingState.FoundConflicts
                : ConflictingKeyBindingState.ConflictsIgnoredOrResolved;
        }
Esempio n. 9
0
 internal CommandKeyBindingSnapshot CreateCommandKeyBindingSnapshot(IVimBuffer vimBuffer)
 {
     var util = new KeyBindingUtil(_dte, GetOrCreateImportantScopeSet());
     return util.CreateCommandKeyBindingSnapshot(vimBuffer);
 }
Esempio n. 10
0
        public void RunConflictingKeyBindingStateCheck(IEnumerable<KeyInput> neededInputs, Action<ConflictingKeyBindingState, CommandKeyBindingSnapshot> onComplete)
        {
            if (_snapshot != null)
            {
                onComplete(_state, _snapshot);
                return;
            }

            var util = new KeyBindingUtil(_dte);
            var set = new HashSet<KeyInput>(neededInputs);
            _snapshot = util.CreateCommandKeyBindingSnapshot(set);
            if (_snapshot.Conflicting.Any())
            {
                ConflictingKeyBindingState = ConflictingKeyBindingState.FoundConflicts;
            }
            else
            {
                ConflictingKeyBindingState = ConflictingKeyBindingState.ConflictsIgnoredOrResolved;
            }
        }
Esempio n. 11
0
 public void ShowDialog(IVimBuffer buffer)
 {
     var util = new KeyBindingUtil(_dte);
     var snapshot = util.CreateCommandKeyBindingSnapshot(buffer);
     UI.ConflictingKeyBindingDialog.DoShow(snapshot);
 }