문제

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.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top