Beispiel #1
0
        /// <summary>
        /// Converts CommandResult to OLE return code
        /// </summary>
        /// <param name="commandResult">Command result</param>
        /// <returns>OLE return code</returns>
        public static int MakeOleResult(CommandResult commandResult) {
            if ((commandResult.Status & CommandStatus.Supported) != 0) {
                return commandResult.Result;
            }

            return (int)Constants.OLECMDERR_E_NOTSUPPORTED;
        }
        public override void PostProcessInvoke(CommandResult result, Guid group, int id, object inputArg, ref object outputArg) {
            if (group == VSConstants.VSStd2K) {
                char typedChar = GetTypedChar(group, id, inputArg);
                if (AutoFormat.IsAutoformatTriggerCharacter(typedChar)) {
                    AutoFormat.HandleAutoformat(TextView, typedChar);
                }

                base.PostProcessInvoke(result, group, id, inputArg, ref outputArg);
            }
        }
        public void PostProcessInvoke(CommandResult result, Guid group, int id, object inputArg, ref object outputArg) {

            // only run for VSStd2K commands and if brace completion is enabled
            if (group == VSConstants.VSStd2K) {
                if (id == (int)VSConstants.VSStd2KCmdID.TYPECHAR) {
                    char typedChar = TypingCommandHandler.GetTypedChar(group, id, inputArg);

                    // handle closing braces if there is an active session
                    if ((Manager.HasActiveSessions && Manager.ClosingBraces.IndexOf(typedChar) > -1)
                        || Manager.OpeningBraces.IndexOf(typedChar) > -1) {
                        Manager.PostTypeChar(typedChar);
                    }
                }
                // tab, delete, backspace, and return only need to be handled if there is an active session
                // tab and return should be skipped if completion is currently active
                else if (Manager.HasActiveSessions) {
                    switch (id) {
                        case (int)VSConstants.VSStd2KCmdID.RETURN:
                            if (!IsCompletionActive) {
                                Manager.PostReturn();
                            }
                            break;
                        case (int)VSConstants.VSStd2KCmdID.TAB:
                            if (!IsCompletionActive) {
                                Manager.PostTab();
                            }
                            break;
                        case (int)VSConstants.VSStd2KCmdID.BACKSPACE:
                            Manager.PostBackspace();
                            break;
                        case (int)VSConstants.VSStd2KCmdID.DELETE:
                            Manager.PostDelete();
                            break;
                    }
                }
            }
        }
Beispiel #4
0
 public virtual void PostProcessInvoke(CommandResult result, Guid group, int id, object inputArg, ref object outputArg) {
 }
 public void PostProcessInvoke(CommandResult result, Guid group, int id, object inputArg, ref object outputArg) {
     _commandTarget.PostProcessInvoke(result, group, id, inputArg, ref outputArg);
 }
Beispiel #6
0
        public void PostProcessInvoke(CommandResult result, Guid group, int id, object inputArg, ref object outputArg) {
            ICommand cmd = Find(group, id);

            if (cmd != null && ChainedController == null)
                cmd.PostProcessInvoke(result, group, id, inputArg, ref outputArg);
        }
        public override void PostProcessInvoke(CommandResult result, Guid group, int id, object inputArg, ref object outputArg) {
            if (result.WasExecuted) {
                char typedChar = '\0';

                if (group == VSConstants.VSStd2K) {
                    // REVIEW: Is the TAB key a trigger for any languages? Maybe this code can be deleted.

                    VSConstants.VSStd2KCmdID vsCmdID = (VSConstants.VSStd2KCmdID)id;
                    typedChar = GetTypedChar(group, id, inputArg);

                    if (vsCmdID == VSConstants.VSStd2KCmdID.TAB) {
                        // Check if there is selection. If so, TAB will translate to 'indent lines' command
                        // and hence we don't want to trigger intellisense on it.
                        if (TextView.Selection.SelectedSpans.Count > 0) {
                            if (TextView.Selection.SelectedSpans[0].Length > 0) {
                                typedChar = '\0';
                            }
                        }
                    }
                }

                if (typedChar != '\0') {
                    OnPostTypeChar(typedChar);
                }
            }
        }