Beispiel #1
0
        private static SnapshotPoint NonIdentifierPositionBefore(SnapshotPoint triggerPoint)
        {
            var line = triggerPoint.GetContainingLine();

            SnapshotPoint start = triggerPoint;

            while (start > line.Start && GlslSpecification.IsIdentifierChar((start - 1).GetChar()))
            {
                start -= 1;
            }

            return(start);
        }
Beispiel #2
0
 private static GlslTokenTypes ClassificationToTokenType(string classification, string word)
 {
     if (classification == PredefinedClassificationTypeNames.Comment)
     {
         return(GlslTokenTypes.Comment);
     }
     if (classification == PredefinedClassificationTypeNames.Number)
     {
         return(GlslTokenTypes.Number);
     }
     if (classification == PredefinedClassificationTypeNames.Operator)
     {
         return(GlslTokenTypes.Operator);
     }
     return(GlslSpecification.AssignType(word));
 }
        public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            bool handled = false;
            int  hresult = VSConstants.S_OK;

            // 1. Pre-process
            if (pguidCmdGroup == VSConstants.VSStd2K)
            {
                switch ((VSConstants.VSStd2KCmdID)nCmdID)
                {
                case VSConstants.VSStd2KCmdID.AUTOCOMPLETE:
                case VSConstants.VSStd2KCmdID.COMPLETEWORD:
                    handled = StartSession();
                    break;

                case VSConstants.VSStd2KCmdID.RETURN:
                    handled = Complete(false);
                    break;

                case VSConstants.VSStd2KCmdID.TAB:
                    handled = Complete(true);
                    break;

                case VSConstants.VSStd2KCmdID.CANCEL:
                    handled = Cancel();
                    break;

                case VSConstants.VSStd2KCmdID.COMMENTBLOCK:
                case VSConstants.VSStd2KCmdID.COMMENT_BLOCK:
                    Comment(TextView);
                    handled = true;
                    break;

                case VSConstants.VSStd2KCmdID.UNCOMMENTBLOCK:
                case VSConstants.VSStd2KCmdID.UNCOMMENT_BLOCK:
                    UnComment(TextView);
                    handled = true;
                    break;
                }
            }
            ThreadHelper.ThrowIfNotOnUIThread();
            if (!handled)
            {
                hresult = Next.Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
            }

            if (ErrorHandler.Succeeded(hresult))
            {
                if (pguidCmdGroup == VSConstants.VSStd2K)
                {
                    switch ((VSConstants.VSStd2KCmdID)nCmdID)
                    {
                    case VSConstants.VSStd2KCmdID.TYPECHAR:
                        var c  = GetTypeChar(pvaIn);
                        var un = '_' == c;
                        if (!GlslSpecification.IsIdentifierChar(c))
                        {
                            Cancel();
                        }
                        else if (_currentSession != null)
                        {
                            Filter();
                        }
                        else if (GlslSpecification.IsIdentifierStartChar(c))
                        {
                            StartSession();
                        }
                        break;

                    case VSConstants.VSStd2KCmdID.BACKSPACE:
                        Filter();
                        break;
                    }
                }
            }

            return(hresult);
        }