/// <summary> /// Returns the list of commands that were previously removed by the user and are no longer currently active. /// </summary> internal List <CommandKeyBinding> FindRemovedKeyBindings(CommandListSnapshot commandListSnapshot) { return(_vimApplicationSettings .RemovedBindings .Where(x => !commandListSnapshot.IsActive(x)) .ToList()); }
private void Create(params string[] args) { _dte = MockObjectFactory.CreateDteWithCommands(args); _commandListSnapshot = new CommandListSnapshot(_dte.Object); var sp = MockObjectFactory.CreateVsServiceProvider( Tuple.Create(typeof(SDTE), (object)(_dte.Object)), Tuple.Create(typeof(SVsShell), (object)(new Mock <IVsShell>(MockBehavior.Strict)).Object)); _optionsDialogService = new Mock <IOptionsDialogService>(MockBehavior.Strict); _vimApplicationSettings = new Mock <IVimApplicationSettings>(MockBehavior.Strict); _vimApplicationSettings.SetupGet(x => x.IgnoredConflictingKeyBinding).Returns(false); _vimApplicationSettings.SetupGet(x => x.HaveUpdatedKeyBindings).Returns(false); var list = new List <CommandKeyBinding>(); _vimApplicationSettings.SetupGet(x => x.RemovedBindings).Returns(list.AsReadOnly()); _serviceRaw = new KeyBindingService( sp.Object, _optionsDialogService.Object, new Mock <IProtectedOperations>().Object, _vimApplicationSettings.Object); _service = _serviceRaw; var result = _dte.Object.Commands.Count; }
internal CommandKeyBindingSnapshot CreateCommandKeyBindingSnapshot(HashSet <KeyInput> vimFirstKeyInputSet) { var commandListSnapshot = new CommandListSnapshot(_dte); var conflicting = FindConflictingCommandKeyBindings(commandListSnapshot, vimFirstKeyInputSet); var removed = FindRemovedKeyBindings(commandListSnapshot); return(new CommandKeyBindingSnapshot( commandListSnapshot, vimFirstKeyInputSet, removed, conflicting)); }
/// <summary> /// Find all of the Command instances (which represent Visual Studio commands) which would conflict with any /// VsVim commands that use the keys in neededInputs. /// </summary> internal List <CommandKeyBinding> FindConflictingCommandKeyBindings(CommandListSnapshot commandsSnapshot, HashSet <KeyInput> neededInputs) { var list = new List <CommandKeyBinding>(); var all = commandsSnapshot.CommandKeyBindings.Where(x => !ShouldSkip(x)); foreach (var binding in all) { var input = binding.KeyBinding.FirstKeyStroke.AggregateKeyInput; if (neededInputs.Contains(input)) { list.Add(binding); } } return(list); }
protected virtual void Create(params EnvDTE.Command[] args) { _dte = MockObjectFactory.CreateDteWithCommands(args); _commandListSnapshot = new CommandListSnapshot(_dte.Object); _optionsDialogService = new Mock<IOptionsDialogService>(MockBehavior.Strict); _vimApplicationSettings = new Mock<IVimApplicationSettings>(MockBehavior.Strict); _vimApplicationSettings.SetupProperty(x => x.IgnoredConflictingKeyBinding, false); _vimApplicationSettings.SetupProperty(x => x.HaveUpdatedKeyBindings, false); _vimApplicationSettings.SetupProperty(x => x.KeyMappingIssueFixed, true); var list = new List<CommandKeyBinding>(); _vimApplicationSettings.SetupGet(x => x.RemovedBindings).Returns(list.AsReadOnly()); _serviceRaw = new KeyBindingService( _dte.Object, _optionsDialogService.Object, new Mock<IVimProtectedOperations>().Object, _vimApplicationSettings.Object, ScopeData.Default); _service = _serviceRaw; var result = _dte.Object.Commands.Count; }
protected virtual void Create(params EnvDTE.Command[] args) { _dte = MockObjectFactory.CreateDteWithCommands(args); _commandListSnapshot = new CommandListSnapshot(_dte.Object); _keyboardOptionsProvider = new Mock <IKeyboardOptionsProvider>(MockBehavior.Strict); _vimApplicationSettings = new Mock <IVimApplicationSettings>(MockBehavior.Strict); _vimApplicationSettings.SetupProperty(x => x.IgnoredConflictingKeyBinding, false); _vimApplicationSettings.SetupProperty(x => x.HaveUpdatedKeyBindings, false); _vimApplicationSettings.SetupProperty(x => x.KeyMappingIssueFixed, true); var list = new List <CommandKeyBinding>(); _vimApplicationSettings.SetupGet(x => x.RemovedBindings).Returns(list.AsReadOnly()); _serviceRaw = new KeyBindingService( _dte.Object, _keyboardOptionsProvider.Object, new Mock <IVimProtectedOperations>().Object, _vimApplicationSettings.Object, ScopeData.Default); _service = _serviceRaw; var result = _dte.Object.Commands.Count; }
/// <summary> /// Returns the list of commands that were previously removed by the user and are no longer currently active. /// </summary> internal List<CommandKeyBinding> FindRemovedKeyBindings(CommandListSnapshot commandListSnapshot) { return _vimApplicationSettings .RemovedBindings .Where(x => !commandListSnapshot.IsActive(x)) .ToList(); }
/// <summary> /// Find all of the Command instances (which represent Visual Studio commands) which would conflict with any /// VsVim commands that use the keys in neededInputs. /// </summary> internal List<CommandKeyBinding> FindConflictingCommandKeyBindings(CommandListSnapshot commandsSnapshot, HashSet<KeyInput> neededInputs) { var list = new List<CommandKeyBinding>(); var all = commandsSnapshot.CommandKeyBindings.Where(x => !ShouldSkip(x)); foreach (var binding in all) { var input = binding.KeyBinding.FirstKeyStroke.AggregateKeyInput; if (neededInputs.Contains(input)) { list.Add(binding); } } return list; }
internal CommandKeyBindingSnapshot CreateCommandKeyBindingSnapshot(HashSet<KeyInput> vimFirstKeyInputSet) { var commandListSnapshot = new CommandListSnapshot(_dte); var conflicting = FindConflictingCommandKeyBindings(commandListSnapshot, vimFirstKeyInputSet); var removed = FindRemovedKeyBindings(commandListSnapshot); return new CommandKeyBindingSnapshot( commandListSnapshot, vimFirstKeyInputSet, removed, conflicting); }
private void Create(params string[] args) { _dte = MockObjectFactory.CreateDteWithCommands(args); _commandListSnapshot = new CommandListSnapshot(_dte.Object); var sp = MockObjectFactory.CreateVsServiceProvider( Tuple.Create(typeof(SDTE), (object)(_dte.Object)), Tuple.Create(typeof(SVsShell), (object)(new Mock<IVsShell>(MockBehavior.Strict)).Object)); _optionsDialogService = new Mock<IOptionsDialogService>(MockBehavior.Strict); _vimApplicationSettings = new Mock<IVimApplicationSettings>(MockBehavior.Strict); _vimApplicationSettings.SetupGet(x => x.IgnoredConflictingKeyBinding).Returns(false); _vimApplicationSettings.SetupGet(x => x.HaveUpdatedKeyBindings).Returns(false); var list = new List<CommandKeyBinding>(); _vimApplicationSettings.SetupGet(x => x.RemovedBindings).Returns(list.AsReadOnly()); _serviceRaw = new KeyBindingService( sp.Object, _optionsDialogService.Object, new Mock<IProtectedOperations>().Object, _vimApplicationSettings.Object); _service = _serviceRaw; var result = _dte.Object.Commands.Count; }