/// <summary> /// Returns the list of commands that were previously removed by the user and are no longer currently active. /// </summary> internal List <CommandKeyBinding> FindRemovedKeyBindings(CommandsSnapshot commandsSnapshot) { return(_legacySettings .FindKeyBindingsMarkedAsRemoved(commandsSnapshot) .Where(x => !commandsSnapshot.IsKeyBindingActive(x.KeyBinding)) .ToList()); }
private static KeyBindingUtil Create(params string[] args) { var all = MockObjectFactory.CreateCommandList(args).Select(x => x.Object); var snapshot = new CommandsSnapshot(all); return(new KeyBindingUtil(snapshot)); }
private void Create(params string[] args) { _dte = MockObjectFactory.CreateDteWithCommands(args); _commandsSnapshot = new CommandsSnapshot(_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; }
/// <summary> /// Returns the list of commands that were previously removed by the user and are no longer currently active. /// </summary> internal List <CommandKeyBinding> FindRemovedKeyBindings(CommandsSnapshot commandsSnapshot) { return(_vimApplicationSettings .RemovedBindings .Where(x => !commandsSnapshot.IsKeyBindingActive(x.KeyBinding)) .ToList()); }
internal CommandKeyBindingSnapshot CreateCommandKeyBindingSnapshot(HashSet <KeyInput> needed) { var commandsSnapshot = new CommandsSnapshot(_dte); var conflicting = FindConflictingCommandKeyBindings(commandsSnapshot, needed); var removed = FindRemovedKeyBindings(commandsSnapshot); return(new CommandKeyBindingSnapshot( commandsSnapshot, 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(CommandsSnapshot 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); }
private void Create(params string[] args) { _dte = MockObjectFactory.CreateDteWithCommands(args); _commandsSnapshot = new CommandsSnapshot(_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); _serviceRaw = new KeyBindingService( sp.Object, _optionsDialogService.Object, new Mock <IProtectedOperations>().Object, new Mock <ILegacySettings>().Object); _service = _serviceRaw; }
private static KeyBindingUtil Create(params string[] args) { var all = MockObjectFactory.CreateCommandList(args).Select(x => x.Object); var snapshot = new CommandsSnapshot(all); return new KeyBindingUtil(snapshot, KeyBindingService.GetDefaultImportantScopeSet()); }
private void Create(params string[] args) { _dte = MockObjectFactory.CreateDteWithCommands(args); _commandsSnapshot = new CommandsSnapshot(_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); _legacySettings = new Mock<ILegacySettings>(MockBehavior.Strict); _legacySettings.SetupGet(x => x.IgnoredConflictingKeyBinding).Returns(false); _legacySettings.SetupGet(x => x.HaveUpdatedKeyBindings).Returns(false); _serviceRaw = new KeyBindingService( sp.Object, _optionsDialogService.Object, new Mock<IProtectedOperations>().Object, _legacySettings.Object); _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(CommandsSnapshot commandsSnapshot) { return _legacySettings.FindKeyBindingsMarkedAsRemoved().Where(x => !commandsSnapshot.IsKeyBindingActive(x.KeyBinding)).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(CommandsSnapshot 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> needed) { var commandsSnapshot = new CommandsSnapshot(_dte); var conflicting = FindConflictingCommandKeyBindings(commandsSnapshot, needed); var removed = FindRemovedKeyBindings(commandsSnapshot); return new CommandKeyBindingSnapshot( commandsSnapshot, removed, conflicting); }
private void Create(params string[] args) { _dte = MockObjectFactory.CreateDteWithCommands(args); _commandsSnapshot = new CommandsSnapshot(_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); _serviceRaw = new KeyBindingService( sp.Object, _optionsDialogService.Object, new Mock<IProtectedOperations>().Object, new Mock<ILegacySettings>().Object); _service = _serviceRaw; }
/// <summary> /// Returns the list of commands that were previously removed by the user and are no longer currently active. /// </summary> internal List<CommandKeyBinding> FindRemovedKeyBindings(CommandsSnapshot commandsSnapshot) { return _vimApplicationSettings .RemovedBindings .Where(x => !commandsSnapshot.IsKeyBindingActive(x.KeyBinding)) .ToList(); }
private static KeyBindingUtil Create(params string[] args) { var all = MockObjectFactory.CreateCommandList(args).Select(x => x.Object); var snapshot = new CommandsSnapshot(all); return new KeyBindingUtil(snapshot); }