Exemple #1
0
        internal static bool IsDebugIgnore(VSConstants.VSStd2KCmdID commandId)
        {
            switch (commandId)
            {
                // A lot of my debugging is essentially figuring out which command is messing up normal mode.
                // Unfortunately VS likes to throw a lot of commands all of the time.  I list them here so they don't
                // come through my default mode where I can then set a break point
                case VSConstants.VSStd2KCmdID.SolutionPlatform:
                case VSConstants.VSStd2KCmdID.FILESYSTEMEDITOR:
                case VSConstants.VSStd2KCmdID.REGISTRYEDITOR:
                case VSConstants.VSStd2KCmdID.FILETYPESEDITOR:
                case VSConstants.VSStd2KCmdID.USERINTERFACEEDITOR:
                case VSConstants.VSStd2KCmdID.CUSTOMACTIONSEDITOR:
                case VSConstants.VSStd2KCmdID.LAUNCHCONDITIONSEDITOR:
                case VSConstants.VSStd2KCmdID.EDITOR:
                case VSConstants.VSStd2KCmdID.VIEWDEPENDENCIES:
                case VSConstants.VSStd2KCmdID.VIEWFILTER:
                case VSConstants.VSStd2KCmdID.VIEWOUTPUTS:
                case VSConstants.VSStd2KCmdID.RENAME:
                case VSConstants.VSStd2KCmdID.ADDOUTPUT:
                case VSConstants.VSStd2KCmdID.ADDFILE:
                case VSConstants.VSStd2KCmdID.MERGEMODULE:
                case VSConstants.VSStd2KCmdID.ADDCOMPONENTS:
                case VSConstants.VSStd2KCmdID.ADDWFCFORM:
                    return true;
            }

            return false;
        }
Exemple #2
0
 private void VerifyConvert(VSConstants.VSStd97CmdID cmd, KeyInput ki, EditCommandKind kind)
 {
     EditCommand command;
     Assert.True(OleCommandUtil.TryConvert(VSConstants.GUID_VSStandardCommandSet97, (uint)cmd, IntPtr.Zero, VimKeyModifiers.None, out command));
     Assert.Equal(ki, command.KeyInput);
     Assert.Equal(kind, command.EditCommandKind);
 }
Exemple #3
0
 private void VerifyConvert(VSConstants.VSStd2KCmdID cmd, VimKeyModifiers modifiers, KeyInput ki, EditCommandKind kind)
 {
     EditCommand command;
     Assert.True(OleCommandUtil.TryConvert(VSConstants.VSStd2K, (uint)cmd, IntPtr.Zero, modifiers, out command));
     Assert.Equal(ki, command.KeyInput);
     Assert.Equal(kind, command.EditCommandKind);
 }
        public bool HandleCommand(VSConstants.VSStd2KCmdID key)
        {
            if (!m_adorned)
                return false;

            if(_translationAdornmentFocused != null && _translationAdornmentFocused.MenuIsOpen)
                return true;

            // Debug.WriteLine(">> VSStd2KCmdID: {0}", key);

            switch (key)
            {
                case VSConstants.VSStd2KCmdID.RETURN:
                case VSConstants.VSStd2KCmdID.TYPECHAR:
                    if (_translationAdornmentFocused != null)
                        _translationAdornmentFocused.TryReplaceWithCurrentItem();
                    return true;
                case VSConstants.VSStd2KCmdID.UP:
                    if (_translationAdornmentFocused != null)
                        _translationAdornmentFocused.MoveCurrentItem(true);
                    return true;
                case VSConstants.VSStd2KCmdID.DOWN:
                    if (_translationAdornmentFocused != null)
                        _translationAdornmentFocused.MoveCurrentItem(false);
                    return true;
                case VSConstants.VSStd2KCmdID.LEFT:
                    if (_translationAdornmentFocused != null)
                        _translationAdornmentFocused.CloseCurrentItemMenu();
                    return true;
                case VSConstants.VSStd2KCmdID.RIGHT:
                case VSConstants.VSStd2KCmdID.SHOWCONTEXTMENU:
                    if (_translationAdornmentFocused != null)
                        _translationAdornmentFocused.OpenCurrentItemMenu();
                    return true;
                case VSConstants.VSStd2KCmdID.CANCEL:
                    ClearTranslations();
                    return true;
                case VSConstants.VSStd2KCmdID.COPY:
                    if (_translationAdornmentFocused != null)
                        _translationAdornmentFocused.CopyCurrentItemText();
                    return true;
                case VSConstants.VSStd2KCmdID.INSERT:
                case VSConstants.VSStd2KCmdID.DELETE:
                case VSConstants.VSStd2KCmdID.BACKSPACE:
                case VSConstants.VSStd2KCmdID.TAB:
                case VSConstants.VSStd2KCmdID.END:
                case VSConstants.VSStd2KCmdID.HOME:
                case VSConstants.VSStd2KCmdID.PAGEDN:
                case VSConstants.VSStd2KCmdID.PAGEUP:
                case VSConstants.VSStd2KCmdID.PASTE:
                case VSConstants.VSStd2KCmdID.PASTEASHTML:
                case VSConstants.VSStd2KCmdID.BOL:
                case VSConstants.VSStd2KCmdID.EOL:
                case VSConstants.VSStd2KCmdID.BACKTAB:
                    return true;
            }

            return false;
        }
 public override string Goto
     (
     VSConstants.VSStd97CmdID cmd,
     IVsTextView textView,
     int line,
     int col,
     out TextSpan span)
     => _data.Goto(cmd, textView, line, col, out span);
Exemple #6
0
 /// <summary>
 /// Verify we can convert the given VimKey to the specified command id
 /// </summary>
 private void VerifyConvert(VimKey vimKey, VSConstants.VSStd2KCmdID cmd)
 {
     var keyInput = KeyInputUtil.VimKeyToKeyInput(vimKey);
     OleCommandData oleCommandData;
     Assert.True(OleCommandUtil.TryConvert(keyInput, false, out oleCommandData));
     Assert.Equal(VSConstants.VSStd2K, oleCommandData.Group);
     Assert.Equal(new OleCommandData(cmd), oleCommandData);
 }
Exemple #7
0
        internal static bool IsDebugIgnore(VSConstants.VSStd97CmdID commandId)
        {
            switch (commandId)
            {
                case VSConstants.VSStd97CmdID.SolutionCfg:
                case VSConstants.VSStd97CmdID.SearchCombo:
                    return true;
            }

            return false;
        }
Exemple #8
0
 public string Goto
     (
     VSConstants.VSStd97CmdID cmd,
     IVsTextView textView,
     int line,
     int col,
     out TextSpan span)
 {
     span = new TextSpan();
     NotImplementedMethod(cmd, textView, line, col, span);
     return null;
 }
Exemple #9
0
        public override void OnCommand(IVsTextView textView, VSConstants.VSStd2KCmdID command, char ch)
        {
            base.OnCommand(textView, command, ch);
            //if (command == VSConstants.VSStd2KCmdID.ECMD_RENAMESYMBOL)
            //{
            //    System.Diagnostics.Debug.WriteLine(command);
            //}
            /*
            if (command == VSConstants.VSStd2KCmdID.TYPECHAR)
            {
                int line, col;
                textView.GetCaretPos(out line, out col);

                TokenInfo tokenInfo = this.GetTokenInfo(line, col);

                if (tokenInfo.Type == TokenType.Identifier && !this.IsCompletorActive)
                    this.Completion(textView, tokenInfo, ParseReason.CompleteWord);
            }
            */
        }
        private void HandleElementValueChanged(VSConstants.VSSELELEMID elementId, object oldValue, object newValue)
        {
            switch (elementId)
            {
            case VSConstants.VSSELELEMID.SEID_DocumentFrame:
                var viewChanged = ViewChanged;
                if (viewChanged != null)
                {
                    ITextView oldView = GetTextView((IVsWindowFrame)oldValue);
                    ITextView newView = GetTextView((IVsWindowFrame)newValue);
                    ViewChangedEventArgs e = new ViewChangedEventArgs(oldView, newView);
                    viewChanged(this, e);
                }

                return;

            case VSConstants.VSSELELEMID.SEID_LastWindowFrame:
                break;

            case VSConstants.VSSELELEMID.SEID_PropertyBrowserSID:
                break;

            case VSConstants.VSSELELEMID.SEID_ResultList:
                break;

            case VSConstants.VSSELELEMID.SEID_StartupProject:
                break;

            case VSConstants.VSSELELEMID.SEID_UndoManager:
                break;

            case VSConstants.VSSELELEMID.SEID_UserContext:
                break;

            case VSConstants.VSSELELEMID.SEID_WindowFrame:
                break;

            default:
                break;
            }
        }
 private void ExecuteCommand(VSConstants.VSStd2KCmdID idCommand, object args = null)
 {
     OldChain.Execute(idCommand, args);
 }
        private static List<VSConstants.VSITEMID> ChildrenOf(IVsHierarchy hierarchy, VSConstants.VSITEMID rootID)
        {
            var result = new List<VSConstants.VSITEMID>();

            for (VSConstants.VSITEMID itemID = FirstChild(hierarchy, rootID); itemID != VSConstants.VSITEMID.Nil; itemID = NextSibling(hierarchy, itemID))
            {
                result.Add(itemID);
                result.AddRange(ChildrenOf(hierarchy, itemID));
            }

            return result;
        }
Exemple #13
0
        internal static bool TryConvert(VSConstants.VSStd2KCmdID cmdId, IntPtr variantIn, out KeyInput ki, out EditCommandKind kind)
        {
            kind = EditCommandKind.Unknown;
            ki = null;
            switch (cmdId)
            {
                case VSConstants.VSStd2KCmdID.TYPECHAR:
                    if (variantIn == IntPtr.Zero)
                    {
                        ki = KeyInputUtil.CharToKeyInput(Char.MinValue);
                    }
                    else
                    {
                        var obj = Marshal.GetObjectForNativeVariant(variantIn);
                        var c = (char)(ushort)obj;
                        ki = KeyInputUtil.CharToKeyInput(c);
                    }
                    kind = EditCommandKind.TypeChar;
                    break;
                case VSConstants.VSStd2KCmdID.RETURN:
                    ki = KeyInputUtil.EnterKey;
                    kind = EditCommandKind.Return;
                    break;
                case VSConstants.VSStd2KCmdID.CANCEL:
                    ki = KeyInputUtil.EscapeKey;
                    kind = EditCommandKind.Cancel;
                    break;
                case VSConstants.VSStd2KCmdID.DELETE:
                    ki = KeyInputUtil.VimKeyToKeyInput(VimKey.Delete);
                    kind = EditCommandKind.Delete;
                    break;
                case VSConstants.VSStd2KCmdID.BACKSPACE:
                    ki = KeyInputUtil.VimKeyToKeyInput(VimKey.Back);
                    kind = EditCommandKind.Backspace;
                    break;
                case VSConstants.VSStd2KCmdID.LEFT:
                case VSConstants.VSStd2KCmdID.LEFT_EXT:
                case VSConstants.VSStd2KCmdID.LEFT_EXT_COL:
                    ki = KeyInputUtil.VimKeyToKeyInput(VimKey.Left);
                    kind = EditCommandKind.CursorMovement;
                    break;
                case VSConstants.VSStd2KCmdID.RIGHT:
                case VSConstants.VSStd2KCmdID.RIGHT_EXT:
                case VSConstants.VSStd2KCmdID.RIGHT_EXT_COL:
                    ki = KeyInputUtil.VimKeyToKeyInput(VimKey.Right);
                    kind = EditCommandKind.CursorMovement;
                    break;
                case VSConstants.VSStd2KCmdID.UP:
                case VSConstants.VSStd2KCmdID.UP_EXT:
                case VSConstants.VSStd2KCmdID.UP_EXT_COL:
                    ki = KeyInputUtil.VimKeyToKeyInput(VimKey.Up);
                    kind = EditCommandKind.CursorMovement;
                    break;
                case VSConstants.VSStd2KCmdID.DOWN:
                case VSConstants.VSStd2KCmdID.DOWN_EXT:
                case VSConstants.VSStd2KCmdID.DOWN_EXT_COL:
                    ki = KeyInputUtil.VimKeyToKeyInput(VimKey.Down);
                    kind = EditCommandKind.CursorMovement;
                    break;
                case VSConstants.VSStd2KCmdID.TAB:
                    ki = KeyInputUtil.TabKey;
                    kind = EditCommandKind.TypeChar;
                    break;
                case VSConstants.VSStd2KCmdID.PAGEDN:
                case VSConstants.VSStd2KCmdID.PAGEDN_EXT:
                    ki = KeyInputUtil.VimKeyToKeyInput(VimKey.PageDown);
                    kind = EditCommandKind.CursorMovement;
                    break;
                case VSConstants.VSStd2KCmdID.PAGEUP:
                case VSConstants.VSStd2KCmdID.PAGEUP_EXT:
                    ki = KeyInputUtil.VimKeyToKeyInput(VimKey.PageUp);
                    kind = EditCommandKind.CursorMovement;
                    break;
                case VSConstants.VSStd2KCmdID.UNDO:
                case VSConstants.VSStd2KCmdID.UNDONOMOVE:
                    ki = KeyInput.DefaultValue;
                    kind = EditCommandKind.Undo;
                    break;
                case VSConstants.VSStd2KCmdID.REDO:
                case VSConstants.VSStd2KCmdID.REDONOMOVE:
                    ki = KeyInput.DefaultValue;
                    kind = EditCommandKind.Redo;
                    break;
                default:
                    break;
            }

            return ki != null;
        }
Exemple #14
0
        internal static bool TryConvert(VSConstants.VSStd2KCmdID cmdId, IntPtr pVariantIn, out KeyInput ki, out EditCommandKind kind)
        {
            kind = EditCommandKind.Unknown;
            ki = null;
            switch (cmdId)
            {
                case VSConstants.VSStd2KCmdID.TYPECHAR:
                    if (pVariantIn == IntPtr.Zero)
                    {
                        return false;
                    }

                    var obj = Marshal.GetObjectForNativeVariant(pVariantIn);
                    var c = (char)(ushort)obj;
                    ki = InputUtil.CharToKeyInput(c);
                    kind = EditCommandKind.TypeChar;
                    break;
                case VSConstants.VSStd2KCmdID.RETURN:
                    ki = InputUtil.VimKeyToKeyInput(VimKey.EnterKey);
                    kind = EditCommandKind.Return;
                    break;
                case VSConstants.VSStd2KCmdID.CANCEL:
                    ki = InputUtil.VimKeyToKeyInput(VimKey.EscapeKey);
                    kind = EditCommandKind.Cancel;
                    break;
                case VSConstants.VSStd2KCmdID.DELETE:
                    ki = InputUtil.VimKeyToKeyInput(VimKey.DeleteKey);
                    kind = EditCommandKind.Delete;
                    break;
                case VSConstants.VSStd2KCmdID.BACKSPACE:
                    ki = InputUtil.VimKeyToKeyInput(VimKey.BackKey);
                    kind = EditCommandKind.Backspace;
                    break;
                case VSConstants.VSStd2KCmdID.LEFT:
                    ki = InputUtil.VimKeyToKeyInput(VimKey.LeftKey);
                    break;
                case VSConstants.VSStd2KCmdID.RIGHT:
                    ki = InputUtil.VimKeyToKeyInput(VimKey.RightKey);
                    break;
                case VSConstants.VSStd2KCmdID.UP:
                    ki = InputUtil.VimKeyToKeyInput(VimKey.UpKey);
                    break;
                case VSConstants.VSStd2KCmdID.DOWN:
                    ki = InputUtil.VimKeyToKeyInput(VimKey.DownKey);
                    break;
                case VSConstants.VSStd2KCmdID.TAB:
                    ki = InputUtil.VimKeyToKeyInput(VimKey.TabKey);
                    break;

                default:
                    break;
            }

            return ki != null;
        }
 private void AssertCanConvert2K(VSConstants.VSStd2KCmdID id, KeyInput expected)
 {
     KeyInput ki;
     Assert.IsTrue(_targetRaw.TryConvert(VSConstants.VSStd2K, (uint)id, IntPtr.Zero, out ki));
     Assert.AreEqual(expected, ki);
 }
 private void AssertCannotConvert2K(VSConstants.VSStd2KCmdID id)
 {
     KeyInput ki;
     Assert.IsFalse(_targetRaw.TryConvert(VSConstants.VSStd2K, (uint)id, IntPtr.Zero, out ki));
 }
Exemple #17
0
 public string Goto(Microsoft.VisualStudio.VSConstants cmd, IVsTextView textView, int line, int col, out TextSpan span)
 {
     throw new NotImplementedException();
 }
Exemple #18
0
 public override string Goto(VSConstants.VSStd97CmdID cmd, IVsTextView textView, int line, int col, out TextSpan span)
 {
     throw new NotImplementedException();
 }
Exemple #19
0
 internal OleCommandData(VSConstants.VSStd2KCmdID id)
     : this((uint)id)
 {
 }
Exemple #20
0
        /// <summary>
        /// Try and convert a Visual Studio 2000 style command into the associated KeyInput and EditCommand items
        /// </summary>
        internal static bool TryConvert(VSConstants.VSStd2KCmdID cmdId, IntPtr variantIn, out KeyInput keyInput, out EditCommandKind kind, out bool isRawText)
        {
            isRawText = false;
            switch (cmdId)
            {
                case VSConstants.VSStd2KCmdID.TYPECHAR:
                    if (variantIn == IntPtr.Zero)
                    {
                        keyInput = KeyInputUtil.CharToKeyInput(Char.MinValue);
                    }
                    else
                    {
                        var obj = Marshal.GetObjectForNativeVariant(variantIn);
                        var c = (char)(ushort)obj;
                        keyInput = KeyInputUtil.CharToKeyInput(c);
                    }
                    kind = EditCommandKind.UserInput;
                    isRawText = true;
                    break;
                case VSConstants.VSStd2KCmdID.RETURN:
                    keyInput = KeyInputUtil.EnterKey;
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd2KCmdID.CANCEL:
                    keyInput = KeyInputUtil.EscapeKey;
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd2KCmdID.DELETE:
                    keyInput = KeyInputUtil.VimKeyToKeyInput(VimKey.Delete);
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd2KCmdID.BACKSPACE:
                    keyInput = KeyInputUtil.VimKeyToKeyInput(VimKey.Back);
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd2KCmdID.LEFT:
                    keyInput = KeyInputUtil.VimKeyToKeyInput(VimKey.Left);
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd2KCmdID.LEFT_EXT:
                case VSConstants.VSStd2KCmdID.LEFT_EXT_COL:
                    keyInput = KeyInputUtil.ApplyModifiersToVimKey(VimKey.Left, KeyModifiers.Shift);
                    kind = EditCommandKind.VisualStudioCommand;
                    break;
                case VSConstants.VSStd2KCmdID.RIGHT:
                    keyInput = KeyInputUtil.VimKeyToKeyInput(VimKey.Right);
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd2KCmdID.RIGHT_EXT:
                case VSConstants.VSStd2KCmdID.RIGHT_EXT_COL:
                    keyInput = KeyInputUtil.ApplyModifiersToVimKey(VimKey.Right, KeyModifiers.Shift);
                    kind = EditCommandKind.VisualStudioCommand;
                    break;
                case VSConstants.VSStd2KCmdID.UP:
                    keyInput = KeyInputUtil.VimKeyToKeyInput(VimKey.Up);
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd2KCmdID.UP_EXT:
                case VSConstants.VSStd2KCmdID.UP_EXT_COL:
                    keyInput = KeyInputUtil.ApplyModifiersToVimKey(VimKey.Up, KeyModifiers.Shift);
                    kind = EditCommandKind.VisualStudioCommand;
                    break;
                case VSConstants.VSStd2KCmdID.DOWN:
                    keyInput = KeyInputUtil.VimKeyToKeyInput(VimKey.Down);
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd2KCmdID.DOWN_EXT:
                case VSConstants.VSStd2KCmdID.DOWN_EXT_COL:
                    keyInput = KeyInputUtil.ApplyModifiersToVimKey(VimKey.Down, KeyModifiers.Shift);
                    kind = EditCommandKind.VisualStudioCommand;
                    break;
                case VSConstants.VSStd2KCmdID.TAB:
                    keyInput = KeyInputUtil.TabKey;
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd2KCmdID.BACKTAB:
                    keyInput = KeyInputUtil.ApplyModifiersToVimKey(VimKey.Tab, KeyModifiers.Shift);
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd2KCmdID.PAGEDN:
                    keyInput = KeyInputUtil.VimKeyToKeyInput(VimKey.PageDown);
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd2KCmdID.PAGEDN_EXT:
                    keyInput = KeyInputUtil.ApplyModifiersToVimKey(VimKey.PageDown, KeyModifiers.Shift);
                    kind = EditCommandKind.VisualStudioCommand;
                    break;
                case VSConstants.VSStd2KCmdID.PAGEUP:
                    keyInput = KeyInputUtil.VimKeyToKeyInput(VimKey.PageUp);
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd2KCmdID.PAGEUP_EXT:
                    keyInput = KeyInputUtil.ApplyModifiersToVimKey(VimKey.PageUp, KeyModifiers.Shift);
                    kind = EditCommandKind.VisualStudioCommand;
                    break;
                case VSConstants.VSStd2KCmdID.UNDO:
                case VSConstants.VSStd2KCmdID.UNDONOMOVE:
                    // Visual Studio was asked to undo.  This happens when either the undo button
                    // was hit or the visual studio key combination bound to the undo command 
                    // was executed
                    keyInput = KeyInput.DefaultValue;
                    kind = EditCommandKind.Undo;
                    break;
                case VSConstants.VSStd2KCmdID.REDO:
                case VSConstants.VSStd2KCmdID.REDONOMOVE:
                    // Visual Studio was asked to redo.  This happens when either the redo button
                    // was hit or the visual studio key combination bound to the redo command 
                    // was executed
                    keyInput = KeyInput.DefaultValue;
                    kind = EditCommandKind.Redo;
                    break;
                case VSConstants.VSStd2KCmdID.BOL:
                    // Even though there as a HOME value defined, Visual Studio apparently maps the 
                    // Home key to BOL
                    keyInput = KeyInputUtil.VimKeyToKeyInput(VimKey.Home);
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd2KCmdID.BOL_EXT:
                case VSConstants.VSStd2KCmdID.BOL_EXT_COL:
                    keyInput = KeyInputUtil.ApplyModifiersToVimKey(VimKey.Home, KeyModifiers.Shift);
                    kind = EditCommandKind.VisualStudioCommand;
                    break;
                case VSConstants.VSStd2KCmdID.EOL:
                    // Even though there as a END value defined, Visual Studio apparently maps the 
                    // Home key to EOL
                    keyInput = KeyInputUtil.VimKeyToKeyInput(VimKey.End);
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd2KCmdID.EOL_EXT:
                case VSConstants.VSStd2KCmdID.EOL_EXT_COL:
                    keyInput = KeyInputUtil.ApplyModifiersToVimKey(VimKey.End, KeyModifiers.Shift);
                    kind = EditCommandKind.VisualStudioCommand;
                    break;
                case VSConstants.VSStd2KCmdID.TOGGLE_OVERTYPE_MODE:
                    // The <Insert> key is expressed in the toggle overtype mode flag.  In general
                    // over write mode is referred to as overtype in the code / documentation
                    keyInput = KeyInputUtil.VimKeyToKeyInput(VimKey.Insert);
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd2KCmdID.PASTE:
                    keyInput = KeyInput.DefaultValue;
                    kind = EditCommandKind.Paste;
                    break;
                case VSConstants.VSStd2KCmdID.COMMENT_BLOCK:
                case VSConstants.VSStd2KCmdID.COMMENTBLOCK:
                    keyInput = KeyInput.DefaultValue;
                    kind = EditCommandKind.Comment;
                    break;
                case VSConstants.VSStd2KCmdID.UNCOMMENT_BLOCK:
                case VSConstants.VSStd2KCmdID.UNCOMMENTBLOCK:
                    keyInput = KeyInput.DefaultValue;
                    kind = EditCommandKind.Uncomment;
                    break;
                default:
                    keyInput = null;
                    kind = EditCommandKind.UserInput;
                    break;
            }

            return keyInput != null;
        }
 // ParseReason.Goto
 // Called by Visual Studio to get the go to function
 // this has not been implemented yet
 public override string Goto(VSConstants.VSStd97CmdID cmd, IVsTextView textView, int line, int col, out TextSpan span)
 {
     // throw new System.NotImplementedException();
     span = new TextSpan();
     return null;
 }
        private static VSConstants.VSITEMID FirstChild(IVsHierarchy hierarchy, VSConstants.VSITEMID rootID)
        {
            object childIDObj = null;
            hierarchy.GetProperty((uint)rootID, (int)__VSHPROPID.VSHPROPID_FirstChild, out childIDObj);
            if (childIDObj != null)
            {
                return (VSConstants.VSITEMID)(int)childIDObj;
            }

            return VSConstants.VSITEMID.Nil;
        }
Exemple #23
0
        internal static bool TryConvert(VSConstants.VSStd97CmdID cmdId, IntPtr pVariantIn, out KeyInput ki, out EditCommandKind kind)
        {
            ki = null;
            kind = EditCommandKind.Unknown;
            switch (cmdId)
            {
                case VSConstants.VSStd97CmdID.SingleChar:
                    var obj = Marshal.GetObjectForNativeVariant(pVariantIn);
                    var c = (char)(ushort)obj;
                    ki = InputUtil.CharToKeyInput(c);
                    kind = EditCommandKind.TypeChar;
                    break;
                case VSConstants.VSStd97CmdID.Escape:
                    ki = InputUtil.VimKeyToKeyInput(VimKey.EscapeKey);
                    kind = EditCommandKind.Cancel;
                    break;
                case VSConstants.VSStd97CmdID.Delete:
                    ki = InputUtil.VimKeyToKeyInput(VimKey.DeleteKey);
                    kind = EditCommandKind.Delete;
                    break;
            }

            return ki != null;
        }
        private static VSConstants.VSITEMID NextSibling(IVsHierarchy hierarchy, VSConstants.VSITEMID firstID)
        {
            object siblingIDObj = null;
            hierarchy.GetProperty((uint)firstID, (int)__VSHPROPID.VSHPROPID_NextSibling, out siblingIDObj);
            if (siblingIDObj != null)
            {
                return (VSConstants.VSITEMID)(int)siblingIDObj;
            }

            return VSConstants.VSITEMID.Nil;
        }
Exemple #25
0
 /// <summary>
 /// Verify the given VimKey converts to the provided command id and vice versa 
 /// </summary>
 private void VerifyBothWays(VSConstants.VSStd2KCmdID cmd, VimKey vimKey, EditCommandKind kind = EditCommandKind.UserInput)
 {
     VerifyConvert(cmd, vimKey, kind);
 }
Exemple #26
0
        /// <summary>
        /// Try and convert the Visual Studio 97 based command into KeyInput and EditCommandKind values
        /// </summary>
        internal static bool TryConvert(VSConstants.VSStd97CmdID cmdId, IntPtr variantIn, out KeyInput ki, out EditCommandKind kind, out bool isRawText)
        {
            ki = null;
            kind = EditCommandKind.UserInput;
            isRawText = false;

            switch (cmdId)
            {
                case VSConstants.VSStd97CmdID.SingleChar:
                    var obj = Marshal.GetObjectForNativeVariant(variantIn);
                    var c = (char)(ushort)obj;
                    ki = KeyInputUtil.CharToKeyInput(c);
                    kind = EditCommandKind.UserInput;
                    isRawText = true;
                    break;
                case VSConstants.VSStd97CmdID.Escape:
                    ki = KeyInputUtil.EscapeKey;
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd97CmdID.Delete:
                    ki = KeyInputUtil.VimKeyToKeyInput(VimKey.Delete);
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd97CmdID.F1Help:
                    ki = KeyInputUtil.VimKeyToKeyInput(VimKey.F1);
                    kind = EditCommandKind.UserInput;
                    break;
                case VSConstants.VSStd97CmdID.Undo:
                    ki = KeyInput.DefaultValue;
                    kind = EditCommandKind.Undo;
                    break;
                case VSConstants.VSStd97CmdID.Redo:
                    ki = KeyInput.DefaultValue;
                    kind = EditCommandKind.Redo;
                    break;
                case VSConstants.VSStd97CmdID.MultiLevelUndo:
                    // This occurs when the undo button is pressed.  If it's just simply pressed we get 
                    // a IntPtr.Zero 'variantIn' value and can proceed with Vim undo.  Else user selected
                    // a very specific undo point and we shouldn't mess with it
                    if (variantIn == IntPtr.Zero)
                    {
                        ki = KeyInput.DefaultValue;
                        kind = EditCommandKind.Undo;
                    }
                    break;
                case VSConstants.VSStd97CmdID.MultiLevelRedo:
                    // This occurs when the redo button is pressed.  If it's just simply pressed we get 
                    // a IntPtr.Zero 'variantIn' value and can proceed with Vim redo .  Else user selected
                    // a very specific redo point and we shouldn't mess with it
                    if (variantIn == IntPtr.Zero)
                    {
                        ki = KeyInput.DefaultValue;
                        kind = EditCommandKind.Redo;
                    }
                    break;
                case VSConstants.VSStd97CmdID.GotoDecl:
                case VSConstants.VSStd97CmdID.GotoDefn:
                    ki = KeyInput.DefaultValue;
                    kind = EditCommandKind.GoToDefinition;
                    break;
                case VSConstants.VSStd97CmdID.Paste:
                    ki = KeyInput.DefaultValue;
                    kind = EditCommandKind.Paste;
                    break;
            }

            return ki != null;
        }
Exemple #27
0
 private void VerifyConvert(VSConstants.VSStd2KCmdID cmd, KeyInput ki, EditCommandKind kind)
 {
     VerifyConvert(cmd, KeyModifiers.None, ki, kind);
 }
        // ParseReason.Goto
        public override string Goto(VSConstants.VSStd97CmdID cmd, IVsTextView textView, int line, int col, out TextSpan span)
        {
            switch (cmd)
            {
                case VSConstants.VSStd97CmdID.GotoDecl:
                case VSConstants.VSStd97CmdID.GotoDefn:
                case VSConstants.VSStd97CmdID.GotoRef:
                    var gotoCreator = new GotoCreator
                                          {
                                              Grammar = Grammar,
                                              Root = Root,
                                              SelectedLine = line,
                                              StepProvider = StepProvider
                                          };
                    gotoCreator.CreateGotoInfo();
                    span = gotoCreator.ResultTextSpan;
                    return gotoCreator.ResultFile;

                default:
                    span = new TextSpan();
                    return null;
            }
        }
Exemple #29
0
 private void VerifyConvert(VSConstants.VSStd97CmdID cmd, VimKey vimKey, EditCommandKind kind)
 {
     VerifyConvert(cmd, KeyInputUtil.VimKeyToKeyInput(vimKey), kind);
 }
 public override string Goto(VSConstants.VSStd97CmdID cmd, IVsTextView textView, int line, int col, out TextSpan span)
 {
     span = new TextSpan();
     return null;
 }
Exemple #31
0
 private void VerifyConvertWithShift(VSConstants.VSStd2KCmdID cmd, VimKey vimKey, EditCommandKind kind)
 {
     var keyInput = KeyInputUtil.ApplyModifiers(KeyInputUtil.VimKeyToKeyInput(vimKey), KeyModifiers.Shift);
     VerifyConvert(cmd, keyInput, kind);
 }