2

Is there a technique to determine the type under the cursor,ActiveDocument.Selection. I can use DTE.ExecuteCommand("Edit.GoToDefinition") to jump around the solution, and start parsing the file etc, but it seems a little kludgy.

I've tried using the FileCodeModel, but I cant get anything useful from it. I could be using it improperly though.

e.g:

void Foo()
{
 int i;
 SomeType st;

 i = 0;
 st = null;
}

If I placed the caret(or selection) on i, I'd like int as a result, if it was over st, I'd like SomeType, and if it was over the declaration of SomeType, again, I would like SomeType as an output.

Ideas?

jasper
  • 3,424
  • 1
  • 25
  • 46

1 Answers1

0

There is a way to find all references see How to implement find all reference? and you can test references found (it is not very efficient and can be time consuming). Hovever I did not managed to make code example working (may be it should run from extension?)

IvanH
  • 5,039
  • 14
  • 60
  • 81
  • I mention what you're talking about in my question. I'm looking for a method to avoid the `GoToDefinition` method. Using the GoToDefinition causes the IDE to jump about, which is annoying. All the same now, no more macros in 2012 :( – jasper Sep 07 '12 at 10:35
  • I appologize for not reading question carefully. So I have another hint. – IvanH Sep 07 '12 at 12:20