private int QueryVisualStudio2014Status(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { switch ((VSConstants.VSStd14CmdID)prgCmds[0].cmdID) { case VSConstants.VSStd14CmdID.SmartBreakLine: return(QueryAutomaticLineEnderStatus(prgCmds)); default: return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } }
/// <remarks>TODO: Revert the change to use standard VS11 command pending https://github.com/dotnet/roslyn/issues/8927 .</remarks> private int QueryInteractiveStatus(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { switch (prgCmds[0].cmdID) { case ID.InteractiveCommands.ExecuteInInteractiveWindow: return(QueryExecuteInInteractiveWindowStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText));; default: return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } }
private int QueryVisualStudio11Status(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { switch ((VSConstants.VSStd11CmdID)prgCmds[0].cmdID) { case VSConstants.VSStd11CmdID.ExecuteSelectionInInteractive: return(QueryExecuteInInteractiveWindowStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText));; default: return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } }
private int QueryVisualStudio2000Status(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { switch ((VSConstants.VSStd2KCmdID)prgCmds[0].cmdID) { case VSConstants.VSStd2KCmdID.OPENFILE: return(QueryOpenFileStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); default: return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } }
// If they haven't given us a context, or we aren't enabled, we should pass along to the next thing in the chain, // instead of trying to have our command handlers to work. public override int Exec(ref Guid pguidCmdGroup, uint commandId, uint executeInformation, IntPtr pvaIn, IntPtr pvaOut) { if (_context == null) { return(NextCommandTarget.Exec(pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } // NOTE: at this point base.Exec will still call NextCommandTarget.Exec like above, but we // are skipping some special handling in a few cases, and also enabling GC Low Latency mode. return(base.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); }
private int QueryVisualStudio97Status(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { switch ((VSConstants.VSStd97CmdID)prgCmds[0].cmdID) { case VSConstants.VSStd97CmdID.GotoDefn: return(QueryGoToDefinitionStatus(prgCmds)); default: return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } }
private int QueryRoslynGroupStatus(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { switch (prgCmds[0].cmdID) { case ID.RoslynCommands.GoToImplementation: return(QueryGoToImplementationStatus(prgCmds)); default: return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } }
private int QueryRoslynGroupStatus(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { switch (prgCmds[0].cmdID) { case ID.RoslynCommands.GoToImplementation: prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_SUPPORTED); return(VSConstants.S_OK); default: return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } }
private int QueryVisualStudio2014Status(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { switch ((VSConstants.VSStd14CmdID)prgCmds[0].cmdID) { case VSConstants.VSStd14CmdID.SmartBreakLine: prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_SUPPORTED | OLECMDF.OLECMDF_INVISIBLE); return(VSConstants.S_OK); default: return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } }
public override int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { var result = NextCommandTarget.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); if (result == VSConstants.S_OK && pguidCmdGroup == CommandGroup && CommandIds.Contains(nCmdID)) { var typedChar = (char)(ushort)Marshal.GetObjectForNativeVariant(pvaIn); _signatureHelpManager.HandleTextInput(typedChar.ToString()); } return(result); }
private int QueryVisualStudio2000Status(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { switch ((VSConstants.VSStd2KCmdID)prgCmds[0].cmdID) { case VSConstants.VSStd2KCmdID.FORMATDOCUMENT: prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_SUPPORTED); return(VSConstants.S_OK); default: return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } }
private int QueryCSharpGroupStatus(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { switch (prgCmds[0].cmdID) { case ID.CSharpCommands.OrganizeRemoveAndSort: case ID.CSharpCommands.ContextOrganizeRemoveAndSort: return(QuerySortAndRemoveUnusedUsingsStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); default: return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } }
// Our immediate window filter has to override this behavior in the default // AbstractOLECommandTarget because they'll send us SCROLLUP when the key typed was CANCEL // (see below) protected override int ExecuteVisualStudio2000(ref Guid pguidCmdGroup, uint commandId, uint executeInformation, IntPtr pvaIn, IntPtr pvaOut) { // We have to ask the buffer to make itself writable, if it isn't already _context.DebuggerTextLines.GetStateFlags(out var bufferFlags); _context.DebuggerTextLines.SetStateFlags((uint)((BUFFERSTATEFLAGS)bufferFlags & ~BUFFERSTATEFLAGS.BSF_USER_READONLY)); var result = VSConstants.S_OK; // If the caret is outside our projection, defer to the next command target. var caretPosition = _context.DebuggerTextView.GetCaretPoint(_context.Buffer); if (caretPosition == null) { return(NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } switch ((VSConstants.VSStd2KCmdID)commandId) { // If we see a RETURN, and we're in the immediate window, we'll want to rebuild // spans after all the other command handlers have run. case VSConstants.VSStd2KCmdID.RETURN: result = NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut); _context.RebuildSpans(); break; // After handling typechar of '?', start completion. case VSConstants.VSStd2KCmdID.TYPECHAR: result = NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut); if ((char)(ushort)Marshal.GetObjectForNativeVariant(pvaIn) == '?') { if (_context.CompletionStartsOnQuestionMark) { // The subject buffer passed in through the command // target isn't the one we want, because we've // definitely remapped buffers. Ask our context for // the real subject buffer. NextCommandTarget.Exec(VSConstants.VSStd2K, (uint)VSConstants.VSStd2KCmdID.SHOWMEMBERLIST, executeInformation, pvaIn, pvaOut); } } break; default: return(base.ExecuteVisualStudio2000(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } _context.DebuggerTextLines.SetStateFlags(bufferFlags); return(result); }
private int QueryCSharpGroupStatus(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { switch (prgCmds[0].cmdID) { case ID.CSharpCommands.OrganizeRemoveAndSort: case ID.CSharpCommands.ContextOrganizeRemoveAndSort: prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_SUPPORTED); return(VSConstants.S_OK); default: return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } }
private int QueryAppCommandStatus(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { switch ((VSConstants.AppCommandCmdID)prgCmds[0].cmdID) { case VSConstants.AppCommandCmdID.BrowserBackward: case VSConstants.AppCommandCmdID.BrowserForward: prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_SUPPORTED); return(VSConstants.S_OK); default: return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } }
public virtual int Exec(ref Guid pguidCmdGroup, uint commandId, uint executeInformation, IntPtr pvaIn, IntPtr pvaOut) { var subjectBuffer = GetSubjectBufferContainingCaret(); // If we didn't get a subject buffer, then that means we're outside our code and we should ignore it // Also, ignore the command if executeInformation indicates isn't meant to be executed. From env\msenv\core\cmdwin.cpp: // To query the parameter type list of a command, we call Exec with // the LOWORD of nCmdexecopt set to OLECMDEXECOPT_SHOWHELP (instead of // the more usual OLECMDEXECOPT_DODEFAULT), the HIWORD of nCmdexecopt // set to VSCmdOptQueryParameterList, pvaIn set to NULL, and pvaOut // pointing to a VARIANT ready to receive the result BSTR. var shouldSkipCommand = executeInformation == (((uint)VsMenus.VSCmdOptQueryParameterList << 16) | (uint)OLECMDEXECOPT.OLECMDEXECOPT_SHOWHELP); if (subjectBuffer == null || shouldSkipCommand) { return(NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } var contentType = subjectBuffer.ContentType; if (pguidCmdGroup == VSConstants.VSStd2K) { return(ExecuteVisualStudio2000(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut, subjectBuffer, contentType)); } else if (pguidCmdGroup == Guids.CSharpGroupId) { return(ExecuteCSharpGroup(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut, subjectBuffer, contentType)); } else if (pguidCmdGroup == VSConstants.GUID_VSStandardCommandSet97) { return(ExecuteVisualStudio97(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut, subjectBuffer, contentType)); } #if INTERACTIVE else if (pguidCmdGroup == InteractiveGuids.InteractiveCommandSetId) { return(ExecuteInteractiveCommands(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut, subjectBuffer, contentType)); } #endif else if (pguidCmdGroup == VSConstants.VsStd14) { return(ExecuteVisualStudio2014(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut, subjectBuffer, contentType)); } else if (pguidCmdGroup == VSConstants.GUID_AppCommand) { return(ExecuteAppCommand(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut, subjectBuffer, contentType)); } else { return(NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } }
private int QueryVisualStudio97Status(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { switch ((VSConstants.VSStd97CmdID)prgCmds[0].cmdID) { case VSConstants.VSStd97CmdID.GotoDefn: case VSConstants.VSStd97CmdID.FindReferences: case VSConstants.VSStd97CmdID.SyncClassView: prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_SUPPORTED); return(VSConstants.S_OK); default: return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } }
private int QueryInteractiveCommandStatus(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { switch ((InteractiveCommandIds)prgCmds[0].cmdID) { case InteractiveCommandIds.ExecuteInInteractiveWindow: return QueryExecuteInInteractiveWindowStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText); case InteractiveCommandIds.CopyToInteractiveWindow: return QueryCopyToInteractiveWindowStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText); default: return NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText); } }
private int GetCommandState <T>( Func <ITextView, ITextBuffer, T> createArgs, ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) where T : CommandArgs { var result = VSConstants.S_OK; var guidCmdGroup = pguidCmdGroup; CommandState executeNextCommandTarget() { result = NextCommandTarget.QueryStatus(ref guidCmdGroup, commandCount, prgCmds, commandText); var isAvailable = ((OLECMDF)prgCmds[0].cmdf & OLECMDF.OLECMDF_ENABLED) == OLECMDF.OLECMDF_ENABLED; var isChecked = ((OLECMDF)prgCmds[0].cmdf & OLECMDF.OLECMDF_LATCHED) == OLECMDF.OLECMDF_LATCHED; return(new CommandState(isAvailable, isChecked, GetText(commandText))); } CommandState commandState; var subjectBuffer = GetSubjectBufferContainingCaret(); if (subjectBuffer == null) { commandState = executeNextCommandTarget(); } else { commandState = CurrentHandlers.GetCommandState <T>( subjectBuffer.ContentType, args: createArgs(ConvertTextView(), subjectBuffer), lastHandler: executeNextCommandTarget); } var enabled = commandState.IsAvailable ? OLECMDF.OLECMDF_ENABLED : OLECMDF.OLECMDF_INVISIBLE; var latched = commandState.IsChecked ? OLECMDF.OLECMDF_LATCHED : OLECMDF.OLECMDF_NINCHED; prgCmds[0].cmdf = (uint)(enabled | latched | OLECMDF.OLECMDF_SUPPORTED); if (!string.IsNullOrEmpty(commandState.DisplayText) && GetText(commandText) != commandState.DisplayText) { SetText(commandText, commandState.DisplayText); } return(result); }
public int QueryStatus(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { Contract.ThrowIfFalse(commandCount == 1); Contract.ThrowIfFalse(prgCmds.Length == 1); // TODO: We'll need to extend the command handler interfaces at some point when we have commands that // require enabling/disabling at some point. For now, we just enable the few that we care about. if (pguidCmdGroup == VSConstants.VsStd14) { return(QueryVisualStudio2014Status(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } else { return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } }
private int QueryVisualStudio2000Status(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { switch ((VSConstants.VSStd2KCmdID)prgCmds[0].cmdID) { case VSConstants.VSStd2KCmdID.FORMATDOCUMENT: return(QueryFormatDocumentStatus(prgCmds)); case VSConstants.VSStd2KCmdID.FORMATSELECTION: return(QueryFormatSelectionStatus(prgCmds)); case CmdidToggleConsumeFirstMode: return(QueryToggleConsumeFirstModeStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); case VSConstants.VSStd2KCmdID.COMMENT_BLOCK: case VSConstants.VSStd2KCmdID.COMMENTBLOCK: return(QueryCommentBlockStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); case VSConstants.VSStd2KCmdID.UNCOMMENT_BLOCK: case VSConstants.VSStd2KCmdID.UNCOMMENTBLOCK: return(QueryUncommentBlockStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); case CmdidNextHighlightedReference: case CmdidPreviousHighlightedReference: return(QueryNavigateHighlightedReferenceStatus(prgCmds)); case VSConstants.VSStd2KCmdID.COMPLETEWORD: return(QueryCompleteWordStatus(prgCmds)); case VSConstants.VSStd2KCmdID.SHOWMEMBERLIST: return(QueryShowMemberListStatus(prgCmds)); case VSConstants.VSStd2KCmdID.PARAMINFO: return(QueryParameterInfoStatus(prgCmds)); case VSConstants.VSStd2KCmdID.QUICKINFO: return(QueryQuickInfoStatus(prgCmds)); case VSConstants.VSStd2KCmdID.OUTLN_START_AUTOHIDING: return(QueryStartAutomaticOutliningStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); case VSConstants.VSStd2KCmdID.OPENFILE: return(QueryOpenFileStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); default: return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } }
private int QuerySortAndRemoveUnusedUsingsStatus(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { var textBuffer = GetSubjectBufferContainingCaret(); if (textBuffer != null) { if (CodeAnalysis.Workspace.TryGetWorkspace(textBuffer.AsTextContainer(), out var workspace)) { var organizeImportsService = workspace.Services.GetLanguageServices(textBuffer).GetService <IOrganizeImportsService>(); if (organizeImportsService != null) { SetText(commandText, organizeImportsService.SortAndRemoveUnusedImportsDisplayStringWithAccelerator); } } } return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); }
private int ExecuteVisualStudio97(ref Guid pguidCmdGroup, uint commandId, uint executeInformation, IntPtr pvaIn, IntPtr pvaOut) { switch ((VSConstants.VSStd97CmdID)commandId) { case VSConstants.VSStd97CmdID.Paste: case VSConstants.VSStd97CmdID.Delete: case VSConstants.VSStd97CmdID.SelectAll: case VSConstants.VSStd97CmdID.Undo: case VSConstants.VSStd97CmdID.Redo: case VSConstants.VSStd97CmdID.MultiLevelUndo: case VSConstants.VSStd97CmdID.MultiLevelRedo: GCManager.UseLowLatencyModeForProcessingUserInput(); return(NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); default: return(NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } }
private int QueryOrganizeMenu(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { var textBuffer = GetSubjectBufferContainingCaret(); if (textBuffer != null) { Workspace workspace; if (Workspace.TryGetWorkspace(textBuffer.AsTextContainer(), out workspace)) { var organizeImportsService = workspace.Services.GetLanguageServices(textBuffer).GetService<IOrganizeImportsService>(); if (organizeImportsService != null) { SetText(commandText, organizeImportsService.OrganizeImportsDisplayStringWithAccelerator); } } } return NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText); }
public int QueryStatus(ref Guid pguidCmdGroup, uint commandCount, OLECMD[] prgCmds, IntPtr commandText) { Contract.ThrowIfFalse(commandCount == 1); Contract.ThrowIfFalse(prgCmds.Length == 1); // TODO: We'll need to extend the command handler interfaces at some point when we have commands that // require enabling/disabling at some point. For now, we just enable the few that we care about. if (pguidCmdGroup == VSConstants.VSStd2K) { return(QueryVisualStudio2000Status(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } else if (pguidCmdGroup == Guids.CSharpGroupId) { return(QueryCSharpGroupStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } else if (pguidCmdGroup == VSConstants.GUID_VSStandardCommandSet97) { return(QueryVisualStudio97Status(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } #if INTERACTIVE else if (pguidCmdGroup == InteractiveGuids.InteractiveCommandSetId) { return(QueryInteractiveCommandStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } #endif else if (pguidCmdGroup == VSConstants.VsStd14) { return(QueryVisualStudio2014Status(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } else if (pguidCmdGroup == VSConstants.GUID_AppCommand) { return(QueryAppCommandStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } else if (pguidCmdGroup == Guids.RoslynGroupId) { return(QueryRoslynGroupStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } else { return(NextCommandTarget.QueryStatus(ref pguidCmdGroup, commandCount, prgCmds, commandText)); } }
public virtual int Exec(ref Guid pguidCmdGroup, uint commandId, uint executeInformation, IntPtr pvaIn, IntPtr pvaOut) { try { this.CurrentlyExecutingCommand = commandId; // If we don't have a subject buffer, then that means we're outside our code and we should ignore it // Also, ignore the command if executeInformation indicates isn't meant to be executed. From env\msenv\core\cmdwin.cpp: // To query the parameter type list of a command, we call Exec with // the LOWORD of nCmdexecopt set to OLECMDEXECOPT_SHOWHELP (instead of // the more usual OLECMDEXECOPT_DODEFAULT), the HIWORD of nCmdexecopt // set to VSCmdOptQueryParameterList, pvaIn set to NULL, and pvaOut // pointing to a VARIANT ready to receive the result BSTR. var shouldSkipCommand = executeInformation == (((uint)VsMenus.VSCmdOptQueryParameterList << 16) | (uint)OLECMDEXECOPT.OLECMDEXECOPT_SHOWHELP); if (shouldSkipCommand || GetSubjectBufferContainingCaret() == null) { return(NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } if (pguidCmdGroup == VSConstants.VSStd2K) { return(ExecuteVisualStudio2000(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } else if (pguidCmdGroup == VSConstants.GUID_VSStandardCommandSet97) { return(ExecuteVisualStudio97(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } else if (pguidCmdGroup == VSConstants.GUID_AppCommand) { return(ExecuteAppCommand(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } else { return(NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } } finally { this.CurrentlyExecutingCommand = default; } }
/// <remarks>TODO: Revert the change to use standard VS11 command pending https://github.com/dotnet/roslyn/issues/8927 .</remarks> private int ExecuteInteractive(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 (commandId) { case ID.InteractiveCommands.ExecuteInInteractiveWindow: ExecuteExecuteInInteractiveWindow(subjectBuffer, contentType, executeNextCommandTarget); break; default: return(NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } return(result); }
private int ExecuteVisualStudio2014(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.VSStd14CmdID)commandId) { case VSConstants.VSStd14CmdID.SmartBreakLine: ExecuteAutomaticLineEnder(subjectBuffer, contentType, executeNextCommandTarget); break; default: return(NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } return(result); }
protected virtual int ExecuteVisualStudio2000(ref Guid pguidCmdGroup, uint commandId, uint executeInformation, IntPtr pvaIn, IntPtr pvaOut) { 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.OPENFILE: ExecuteOpenFile(executeNextCommandTarget); break; default: return(NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut)); } return(result); }
public override int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { // Check for commit character. var typedChar = char.MinValue; if (pguidCmdGroup == CommandGroup && CommandIds.Contains(nCmdID)) { if (nCmdID == (uint)VSConstants.VSStd2KCmdID.TYPECHAR) { typedChar = (char)(ushort)Marshal.GetObjectForNativeVariant(pvaIn); } var isCommit = nCmdID == (uint)VSConstants.VSStd2KCmdID.RETURN || nCmdID == (uint)VSConstants.VSStd2KCmdID.TAB; var isCompletion = isCommit || char.IsWhiteSpace(typedChar) || (char.IsPunctuation(typedChar) && typedChar != '_'); if (isCompletion && _completionModelManager.Commit()) { if (isCommit) { return(VSConstants.S_OK); // Don't add commit char to buffer. } } } // Pass command to next command target. var result = NextCommandTarget.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); if (result == VSConstants.S_OK && pguidCmdGroup == CommandGroup && CommandIds.Contains(nCmdID)) { var isTrigger = typedChar != char.MinValue && (char.IsLetterOrDigit(typedChar) || typedChar == '.'); _completionModelManager.HandleTextInput(isTrigger); } return(result); }