I've written an extension to comb through code files line by line to detect certain patterns. The problem I'm seeing is that lines within collapsed sections are skipped when using
TextSelection.LineDown() or similar. I'm aware that
TextSelection.OutlineSection() exists to create such sections, but is there a way to detect, and possibly expand or collapse them?
Best How To :
In your scenario you don't have to use TextSelection, since that is related to...text selection. To traverse the lines of a code file, given an EnvDTE.TextDocument, you have the TextDocument.StartPoint property to get a EnvDTE.TextPoint and then you create an EnvDTE.EditPoint with TextPoint.CreateEditPoint(). With an EnvDTE.EditPoint you can GetText(...), MoveToXXX(...) etc. EditPoints are not affected by collapsed text.