void HighlightCategorizedToken(CategorizedToken token, List <SyntaxHighlightToken> syntaxTokens)
        {
            SyntaxHighlightProperties highlightProperties = _syntaxHighlightInfo.CalculateTokenCategoryHighlight(token.Category);
            SyntaxHighlightToken      syntaxToken         = SetTokenColor(token, highlightProperties);

            if (syntaxToken != null)
            {
                syntaxTokens.Add(syntaxToken);
            }
        }
Exemple #2
0
        void HighlightCategorizedToken(CategorizedToken token, List <SyntaxHighlightToken> syntaxTokens)
        {
            Color backColor = editor.ActiveView.BackColor;
            SyntaxHighlightProperties highlightProperties = syntaxHighlightInfo.CalculateTokenCategoryHighlight(token.Category);
            SyntaxHighlightToken      syntaxToken         = SetTokenColor(token, highlightProperties, backColor);

            if (syntaxToken != null)
            {
                syntaxTokens.Add(syntaxToken);
            }
        }
Exemple #3
0
        bool IsIntersect(DocumentRange range, SyntaxHighlightToken token)
        {
            int start = range.Start.ToInt();

            if (start >= token.Start && start < token.End)
            {
                return(true);
            }
            int end = range.End.ToInt() - 1;

            if (end >= token.Start && end < token.End)
            {
                return(true);
            }
            return(false);
        }
        List <SyntaxHighlightToken> CombineWithPlainTextTokens(List <SyntaxHighlightToken> tokens)
        {
            List <SyntaxHighlightToken> result = new List <SyntaxHighlightToken>(tokens.Count * 2 + 1);
            int documentStart = this.document.Range.Start.ToInt();
            int documentEnd   = this.document.Range.End.ToInt();

            if (tokens.Count == 0)
            {
                result.Add(CreateToken(documentStart, documentEnd, Color.Black));
            }
            else
            {
                SyntaxHighlightToken firstToken = tokens[0];
                if (documentStart < firstToken.Start)
                {
                    result.Add(CreateToken(documentStart, firstToken.Start, Color.Black));
                }
                result.Add(firstToken);
                for (int i = 1; i < tokens.Count; i++)
                {
                    SyntaxHighlightToken token     = tokens[i];
                    SyntaxHighlightToken prevToken = tokens[i - 1];
                    if (prevToken.End != token.Start)
                    {
                        result.Add(CreateToken(prevToken.End, token.Start, Color.Black));
                    }
                    result.Add(token);
                }
                SyntaxHighlightToken lastToken = tokens[tokens.Count - 1];
                if (documentEnd > lastToken.End)
                {
                    result.Add(CreateToken(lastToken.End, documentEnd, Color.Black));
                }
            }
            return(result);
        }