开发者

How to create a VS2010 extension that uses Language Services

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?


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.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜