/// <summary> /// Try and convert the Visual Studio command to it's equivalent KeyInput /// </summary> internal bool TryConvert(Guid commandGroup, uint commandId, IntPtr variantIn, out EditCommand editCommand) { editCommand = null; // Don't ever process a command when we are in an automation function. Doing so will cause VsVim to // intercept items like running Macros and certain wizard functionality if (_vsAdapter.InAutomationFunction) { return(false); } // Don't intercept commands while incremental search is active. Don't want to interfere with it if (_vsAdapter.IsIncrementalSearchActive(_vimBuffer.TextView)) { return(false); } var modifiers = _keyUtil.GetKeyModifiers(_vsAdapter.KeyboardDevice.Modifiers); if (!OleCommandUtil.TryConvert(commandGroup, commandId, variantIn, modifiers, out editCommand)) { return(false); } // Don't process Visual Studio commands. If the key sequence is mapped to a Visual Studio command // then that command wins. if (editCommand.EditCommandKind == EditCommandKind.VisualStudioCommand) { return(false); } return(true); }
internal bool IsEditCommand(Guid commandGroup, uint commandId) { EditCommand command; return OleCommandUtil.TryConvert(commandGroup, commandId, IntPtr.Zero, VimKeyModifiers.None, out command) && command.HasKeyInput; }
internal static int Exec(this IOleCommandTarget oleCommandTarget, KeyInput keyInput) { var oleCommandData = OleCommandData.Empty; try { if (!OleCommandUtil.TryConvert(keyInput, out oleCommandData)) { return(VSConstants.E_FAIL); } return(oleCommandTarget.Exec(oleCommandData)); } finally { oleCommandData.Dispose(); } }