Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

context.TextView.VisualLinesValid always throws exception in DocumentColorizingTransformer

$
0
0

I have a class derived from DocumentColorizingTransformer and I am overriding the Colorize & ColorizeLine functions. I want to just loop over all the visual lines in Colorize & then call ColorizeLine for each line in turn. However iterating over all the Visual Lines in the context.TextView always throws an exception. What am i doing wrong ? My function for Colorize looks like this.

        protected override void Colorize(ITextRunConstructionContext context)

        {

            try

            {

                int firstLineStart = m_parent.textEditor.Document.GetLineByNumber(1).Offset;

 

                foreach (VisualLine e in context.TextView.VisualLines)

                {

                    DocumentLine currentDocumentLine = context.Document.GetLineByNumber(e.FirstDocumentLine.LineNumber);

                    ColorizeLine(currentDocumentLine);

                }

            }

            catch (System.Exception ex)

            {

 

            }

        }


Viewing all articles
Browse latest Browse all 1764

Trending Articles