R#8 plugin daemon command line tool

Hello.

I'm working on plugin, that calculates some metrics against the c# sources. Currently metrics are calculates by a daemon.
For my purpose(at the beginning) it will be convenient to pack plugin logic into command line tool, launch it time after time and get report.
Can do it(and how exactly) with a daemon or it needs other approach? I'm tried to find examples of command line plugin-tool for R#8.x, but did not succeed.

Kozhevnikov Dmitry.

7 comments
Comment actions Permalink

The ReSharper Command Line Tool support plugins, but it only supports outputting warnings from daemons, so as long as your daemon adds a highlight (squiggly underline) to the code, it should get reported. Is this what you're after?

I'm writing a blog post on how to support plugins in the command line tool, that should be published towards the end of next week. Let me know if you need some info before then.

Thanks
Matt

0
Comment actions Permalink

Thanks for reply. I look foward to a release of your blog post.

Actually I need to provide some metrics from command line tool. My plugin's daemon does not add any highlight at all. I even do not sure that daemon was a good idea, may be I need another approach.
So command line tool must report the metrics once at every start. What did you advice?

Kozhevnikov Dmitry.

0
Comment actions Permalink

The 8.1.1 version of the command line tool (released as part of the new EAP - http://confluence.jetbrains.com/display/ReSharper/ReSharper+8.1.1+EAP) includes a new interface for plugins devs - IInspectCodeConsumer. It's intended to allow you to customise how the warnings and highlights are output, but since it's custom code, you could also use it to output custom information. The custom logger has some documentation here: http://confluence.jetbrains.com/display/NETCOM/Custom+InspectCode+Issue+Logger

As for using a daemon to get the information in the first place, a daemon is useful for analysing a file when it's opened. It will analyse all files when solution wide analysis is enabled in ReSharper, or when being used in the command line tools. To analyse all files and be notified when they change, you can implement the ICache interface. Unfortunately, this isn't documented, but you can use dotPeek to see how it's implemented in ReSharper. This interface is called when the solution is first loaded. If it's the first time the solution has been opened, it will process all source files. As ReSharper runs, and the user edits a file, the cache implementation is notified that the file has changed, and it can re-process and update the cache. The cache implementation is responsible for deciding what data to look at and cache. The cache can also be persisted to disk and reloaded when the solution is subsequently opened. In other words, ICache allows background processing of all files in the solution. I'm not sure how it works with the command line tools, but I believe it's the same - the tools also store cached information (e.g. it's used in CLR type resolution), so as far as I can tell, it all works the same way, except files aren't edited or updated.

0
Comment actions Permalink

Will 8.1.1 SDK EAP be pushed to nuget?

0
Comment actions Permalink

Nope, I don't think so.
And, additional library from CLT is not included in SDK.
That SDK for ReSharper, not CLT.
We'll create additional SDK - for CLT, but I am afrad not earlier version 9.0

0
Comment actions Permalink

So if I am getting sdk 8.1.555 from nuget (that is great!), can I attach CLT libraries to my project and implements IInspectCodeConsumer interface?

Kozhevnikov Dmitry.

0
Comment actions Permalink

On 04.02.2014 4:36, Kozhevnikov Dmitry wrote:

So if I am getting sdk 8.1.555 from nuget (that is great!), can I attach CLT libraries to my project and implements IInspectCodeConsumer interface?


Yep, exactly.

0

Please sign in to leave a comment.