开发者

How to create a VS2010 extension that uses Language Services

开发者 https://www.devze.com 2022-12-27 22:01 出处:网络
Creating extensions got much easier with Vs2010, but this seems not to be开发者_如何转开发 the case for everything...

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

精彩评论

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