views:

272

answers:

1

Creating extensions got much easier with Vs2010, but this seems not to be the case for everything...

My aim: I wnat to make method calls and property uses of STATIC classes ITALIC. (Just like Eclipse and Java)

I think I need to talk to the C# Language Service for this information, but searching for "Language Service" just yields results on how to CREATE one, not how to use one of the existing ones...

To get this question a little more general: How do I get information about properties of the code (static/visibility etc) for using it in a VSX?

+2  A: 

In general to use a language service you query for it using a service provider.

But unfortunately C# language service in VS2010 does not provide public and supported API for getting such kind of information about source code. There is the code model API, but it doesn't support method bodies at all. Future version of Visual Studio will provide such functionality as public supported API.

So I think you options are:

  • Parse source code yourself (e.g. using cci). This is basically what major VS partners like Resharper and CodeRush are doing.
  • I'd also check if DXCore from DevExpress (which is free) exposes such API.
Oleg Tkachenko
Thanks for the elaborate answer! How do you know that future VS version will expose such an API?
Hades32
Thanks to your answer I was able to create a (hackish) version of my project using DxCore: http://gitorious.org/italizeplugin
Hades32