Hello.
I'm writing VS2005 add-in that implements "goto definition" function.
So I get CodeElement2 for each class in the project.If class is defined
inside #region, only region is displayed :(
Here is code that I use show class declaration:
[code]
Window projectWindow =
result.CodeElement.ProjectItem.Open("{7651A701-06E5-11D1-8EBD-00A0C90F26EA}");
projectWindow.Activate();
result.CodeElement.EndPoint.TryToShow(vsPaneShowHow.vsPaneShowTop, 0);
[/code]
How could I know - does CodeElement defined inside region or not? How
could I expand region programmatically?
Thank you.
slush_puppy - 20 Jul 2006 20:09 GMT
This should work for you. This assumes that you have a code element
object in a variable called codeElement:
if (codeElement != null)
{
TextPoint textPoint = codeElement.StartPoint;
TextSelection textSelection =
(TextSelection)window.Document.Selection;
textSelection.MoveToPoint(textPoint, false);
// show it centered
textPoint.TryToShow(vsPaneShowHow.vsPaneShowCentered, null);
}