Вопрос

I am writing an extension for Visual Studio 2012 that contains an ICompletionSourceProvider. I need to determine the type of the identifier at the location of the cursor. I tried the following approaches:

  1. Using IClassifierAggregatorService, I am able to determine that the current word is an identifier, but there is no additional information.
  2. Using DTE2, I can get a CodeElement at the current location, but the model is incomplete and the closest that I can get is the current method (CodeFunction)

It is obvious that Visual Studio has that information, but how can I retrieve it? I only need it to work when editing C# files.

Это было полезно?

Решение

Visual Studio 2012 offers no public API to access this information. We have it, yes, but you can't get to it. You might want to take a look at the Roslyn CTP, where we are working on a set of APIs to support scenarios exactly like your own.

Disclosure: I'm on the Roslyn team.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top