I'm trying to make a reshaprer plugin to add one (or more) configurations, besides executable, static method, project, at resharper's build/run window. Any guidelines where to start? Or how to access build's context and configure? Currently examining the JetBrains.IDE.RunConfig, SolutionBuilders etc but one help would be appreciated. Should this plugin be a SolutionComponent or a SolutionInstanceComponent? Resharper's sdk help lucks documentation on build/run component.
Thank in advance!
You can extend the available run configuration types by implementing
IRunConfig
andIRunConfigProvider
.The
IRunConfigProvider
class needs to be marked as[ShellComponent]
, and can derive from theRunConfigProviderBase
abstract base class. You get to specify a name, e.g."Executable"
, a type identifier, e.g."exe"
and an icon ID. There's also the CreateNew method, which will create a new instance of yourIRunConfig
class, which will be mostly unconfigured, at this point.The
IRunConfig
interface doesn't need to marked as a component, and should also derive fromRunConfigBase
- take a look atRunConfigExe
in dotPeek to see an example of how to implement. You should overrideExecute
in order to actually run whatever it is you need to run. You can use theRunConfigContext
class passed in to actually execute a process from aProcessStartInfo
, or anIProject
- this will execute it either by running the process, debugging it, or something else, such as code coverage or profiling.For an .exe, this is as simple as:
But for a more complicated example, look at
RunConfigMethod.Execute
, which uses its own standalone launcher executable, and passes in command line parameters to load the correct assembly and execute the given static method.Settings are implemented with
ReadSpecific
/SaveSpecific
, and you can provide an editor view model with CreateEditor. You'll need a settings class, something like:The view for the editor is provided by a WPF control that is displayed in a dialog that ReSharper controls. The view needs to be decorated with the
[View]
attribute and must implementIView<T>
whereT
is the concrete class returned fromCreateEditor
. This is how ReSharper will locate the view for the view model returned byCreateEditor
. Again, take a look atRunConfigMethodView
in dotPeek for some more idea of what's going on (and if you look in the resources, you'll be able to see the XAML itself).