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; }
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); }
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); } }
public void ShouldSkip1() { var binding = CreateCommandKeyBinding(KeyInputUtil.VimKeyToKeyInput(VimKey.Left)); Assert.IsTrue(KeyBindingUtil.ShouldSkip(binding)); }
public void IsImportantScope2() { Assert.IsFalse(KeyBindingUtil.IsImportantScope("blah")); Assert.IsFalse(KeyBindingUtil.IsImportantScope("VC Image Editor")); }
public void IsImportantScope1() { Assert.IsTrue(KeyBindingUtil.IsImportantScope("Global")); Assert.IsTrue(KeyBindingUtil.IsImportantScope("Text Editor")); Assert.IsTrue(KeyBindingUtil.IsImportantScope(String.Empty)); }
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; }
internal CommandKeyBindingSnapshot CreateCommandKeyBindingSnapshot(IVimBuffer vimBuffer) { var util = new KeyBindingUtil(_dte, GetOrCreateImportantScopeSet()); return util.CreateCommandKeyBindingSnapshot(vimBuffer); }
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; } }
public void ShowDialog(IVimBuffer buffer) { var util = new KeyBindingUtil(_dte); var snapshot = util.CreateCommandKeyBindingSnapshot(buffer); UI.ConflictingKeyBindingDialog.DoShow(snapshot); }