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); }
public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { if (pguidCmdGroup == CommandGroup && CommandIds.Contains(nCmdID)) { bool result = Execute((TCommandEnum)(object)(int)nCmdID, nCmdexecopt, pvaIn, pvaOut); if (result) { return(VSConstants.S_OK); } } return(nextCommandTarget.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut)); }
private void AddButton_Click(object sender, EventArgs e) { CommandIdEditForm form = new CommandIdEditForm(); if (form.ShowDialog() == DialogResult.OK) { if (CommandIds.Contains(form.CommandId)) { if (valueControl.SelectedItem != null && valueControl.SelectedItem.ToString() != form.CommandId) { valueControl.SelectedItem = form.CommandId; } } else { CommandIds.Add(form.CommandId); valueControl.Items.Add(form.CommandId); valueControl.SelectedItem = form.CommandId; } } }
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); }
public virtual int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) { if (pguidCmdGroup != CommandGroup) { return(nextCommandTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText)); } for (int i = 0; i < cCmds; i++) { if (CommandIds.Contains(prgCmds[i].cmdID)) { if (IsEnabled()) { prgCmds[i].cmdf = (uint)(OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_SUPPORTED); return(VSConstants.S_OK); } prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED; } } return(nextCommandTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText)); }
public bool ContainsId(string id) => CommandIds.Contains(id);