[Monodevelop-devel] Adding tracking spans in the MD text editor

Michael Hutchinson m.j.hutchinson at gmail.com
Wed Apr 7 09:45:13 EDT 2010


On Wed, Apr 7, 2010 at 8:58 AM, nikhil sarda <diff.operator at gmail.com> wrote:
>> (Before you kill me - the region folding isn't stored in a red-black
>> tree this one is currently stored as a 'folding tree' ... has to do with
>> the way I get the data from the parser. This is something like a hybrid
>> tree ... it contains links in the line segment red-black tree -
>> therefore updating it is faster as the domino update effect the MS
>> developers are fearing).
>
> So would you suggest I create my own hybrid tree to keep track of text in the
> text editor? For example, I wanted to keep track of text that violate
> certain rules
> so that I could add little squiggly lines under them. I could probably
> create a tree
> that stores the links to the line segments that I know violate the
> rules. Thing is,
> is there a way to highlight only that part of the line segment which
> has the error?
> AFAIK, whenever theres a parse error, the entire line gets highlighted
> by a red squiggly.

The text editor's error underlining can underline specific portions of
the line - although the markers track a line rather than a span, the
markers can contain column numbers and just render the squiggle under
those columns. The reason the C# syntax error underlines affect the
whole line is that the parser only outputs a start position for the
error. Some of the XML error underlines are localized to specific
tags.

Obviously this isn't as good as real span tracking, but it works okay.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-devel-list mailing list