protected virtual int ExecuteVisualStudio2000(ref Guid pguidCmdGroup, uint commandId, uint executeInformation, IntPtr pvaIn, IntPtr pvaOut) { switch ((VSConstants.VSStd2KCmdID)commandId) { case VSConstants.VSStd2KCmdID.TYPECHAR: case VSConstants.VSStd2KCmdID.RETURN: case VSConstants.VSStd2KCmdID.TAB: case VSConstants.VSStd2KCmdID.BACKTAB: case VSConstants.VSStd2KCmdID.HOME: case VSConstants.VSStd2KCmdID.END: case VSConstants.VSStd2KCmdID.BOL: case VSConstants.VSStd2KCmdID.BOL_EXT: case VSConstants.VSStd2KCmdID.EOL: case VSConstants.VSStd2KCmdID.EOL_EXT: case VSConstants.VSStd2KCmdID.SELECTALL: case VSConstants.VSStd2KCmdID.OPENLINEABOVE: case VSConstants.VSStd2KCmdID.OPENLINEBELOW: case VSConstants.VSStd2KCmdID.UP: case VSConstants.VSStd2KCmdID.DOWN: case VSConstants.VSStd2KCmdID.BACKSPACE: case VSConstants.VSStd2KCmdID.DELETE: case VSConstants.VSStd2KCmdID.ECMD_INSERTCOMMENT: case VSConstants.VSStd2KCmdID.COMPLETEWORD: case VSConstants.VSStd2KCmdID.SHOWMEMBERLIST: case VSConstants.VSStd2KCmdID.PARAMINFO: case VSConstants.VSStd2KCmdID.RENAME: case VSConstants.VSStd2KCmdID.EXTRACTINTERFACE: case VSConstants.VSStd2KCmdID.EXTRACTMETHOD: case VSConstants.VSStd2KCmdID.PASTE: case VSConstants.VSStd2KCmdID.INSERTSNIPPET: case VSConstants.VSStd2KCmdID.SURROUNDWITH: GCManager.UseLowLatencyModeForProcessingUserInput(); return(NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); default: return(NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } }
protected virtual int ExecuteVisualStudio2000(ref Guid pguidCmdGroup, uint commandId, uint executeInformation, IntPtr pvaIn, IntPtr pvaOut, ITextBuffer subjectBuffer, IContentType contentType) { int result = VSConstants.S_OK; var guidCmdGroup = pguidCmdGroup; Action executeNextCommandTarget = () => { result = NextCommandTarget.Exec(ref guidCmdGroup, commandId, executeInformation, pvaIn, pvaOut); }; switch ((VSConstants.VSStd2KCmdID)commandId) { case VSConstants.VSStd2KCmdID.TYPECHAR: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteTypeCharacter(pvaIn, subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.RETURN: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteReturn(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.TAB: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteTab(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.BACKTAB: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteBackTab(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.HOME: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteDocumentStart(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.END: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteDocumentEnd(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.BOL: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteLineStart(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.BOL_EXT: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteLineStartExtend(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.EOL: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteLineEnd(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.EOL_EXT: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteLineEndExtend(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.SELECTALL: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteSelectAll(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.OPENLINEABOVE: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteOpenLineAbove(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.OPENLINEBELOW: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteOpenLineBelow(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.UP: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteUp(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.DOWN: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteDown(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.PAGEDN: ExecutePageDown(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.PAGEUP: ExecutePageUp(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.CANCEL: ExecuteCancel(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.BACKSPACE: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteBackspace(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.DELETE: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteDelete(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.DELETEWORDLEFT: ExecuteWordDeleteToStart(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.DELETEWORDRIGHT: ExecuteWordDeleteToEnd(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.FORMATDOCUMENT: ExecuteFormatDocument(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.FORMATSELECTION: ExecuteFormatSelection(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.ECMD_INSERTCOMMENT: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteInsertComment(subjectBuffer, contentType, executeNextCommandTarget); break; case CmdidToggleConsumeFirstMode: ExecuteToggleConsumeFirstMode(subjectBuffer, contentType, executeNextCommandTarget); break; case CmdidNextHighlightedReference: ExecuteNextHighlightedReference(subjectBuffer, contentType, executeNextCommandTarget); break; case CmdidPreviousHighlightedReference: ExecutePreviousHighlightedReference(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.COMMENTBLOCK: case VSConstants.VSStd2KCmdID.COMMENT_BLOCK: ExecuteCommentBlock(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.UNCOMMENTBLOCK: case VSConstants.VSStd2KCmdID.UNCOMMENT_BLOCK: ExecuteUncommentBlock(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.COMPLETEWORD: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteCommitUniqueCompletionItem(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.SHOWMEMBERLIST: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteInvokeCompletionList(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.PARAMINFO: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteParameterInfo(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.RENAME: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteRename(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.EXTRACTINTERFACE: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteExtractInterface(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.EXTRACTMETHOD: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteExtractMethod(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.PASTE: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecutePaste(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.INSERTSNIPPET: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteInsertSnippet(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.SURROUNDWITH: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteSurroundWith(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.ViewCallHierarchy: ExecuteViewCallHierarchy(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.ENCAPSULATEFIELD: ExecuteEncapsulateField(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.REMOVEPARAMETERS: ExecuteRemoveParameters(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.REORDERPARAMETERS: ExecuteReorderParameters(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.ECMD_NEXTMETHOD: ExecuteGoToNextMethod(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd2KCmdID.ECMD_PREVMETHOD: ExecuteGoToPreviousMethod(subjectBuffer, contentType, executeNextCommandTarget); break; default: return(NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } return(result); }
private int ExecuteVisualStudio97(ref Guid pguidCmdGroup, uint commandId, uint executeInformation, IntPtr pvaIn, IntPtr pvaOut, ITextBuffer subjectBuffer, IContentType contentType) { int result = VSConstants.S_OK; var guidCmdGroup = pguidCmdGroup; Action executeNextCommandTarget = () => { result = NextCommandTarget.Exec(ref guidCmdGroup, commandId, executeInformation, pvaIn, pvaOut); }; switch ((VSConstants.VSStd97CmdID)commandId) { case VSConstants.VSStd97CmdID.GotoDefn: ExecuteGoToDefinition(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd97CmdID.FindReferences: ExecuteFindReferences(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd97CmdID.SyncClassView: ExecuteSyncClassView(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd97CmdID.Paste: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecutePaste(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd97CmdID.Delete: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteDelete(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd97CmdID.SelectAll: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteSelectAll(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd97CmdID.Undo: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteUndo(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd97CmdID.Redo: GCManager.UseLowLatencyModeForProcessingUserInput(); ExecuteRedo(subjectBuffer, contentType, executeNextCommandTarget); break; case VSConstants.VSStd97CmdID.MultiLevelUndo: case VSConstants.VSStd97CmdID.MultiLevelRedo: GCManager.UseLowLatencyModeForProcessingUserInput(); if (pvaOut == IntPtr.Zero) { // mirror logic in COleUndoManager::Exec int count = 1; if (pvaIn != IntPtr.Zero) { object o = Marshal.GetObjectForNativeVariant(pvaIn); if (o == null || o is string) { count = 1; } else if (o is int i) { count = i; } else { count = -1; // we don't want to handle this case } } if (count > 0) { if ((VSConstants.VSStd97CmdID)commandId == VSConstants.VSStd97CmdID.MultiLevelUndo) { ExecuteUndo(subjectBuffer, contentType, executeNextCommandTarget, count: count); } else { ExecuteRedo(subjectBuffer, contentType, executeNextCommandTarget, count: count); } break; } } goto default; default: return(NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } return(result); }