This repository defines a template for easy development of ReSharper and Rider plugins according to the official documentation for the ReSharper SDK and IntelliJ SDK.
Download the JetBrains.ReSharper.SamplePlugin.*.nupkg
template package from the releases page and invoke from the download directory:
dotnet new install JetBrains.ReSharper.SamplePlugin.*.nupkg
Afterwards, a new project can be created from the installed template. The name
identifier should be letters-only:
dotnet new resharper-rider-plugin --name MyAwesomePlugin [--resharper-only] [--build-only]
Warning
The template comes with its own solution file. Therefore, it MUST be used from the command-line as shown above.
This will create a new folder with all the structure ready to go and all identifiers, like namespaces, ids and file names, replaced with MyAwesomePlugin
. Passing --resharper-only
will exclude all Rider related files. With the --build-only --force
, all the build-relevant files can be updated (some reverts are most likely necessary). Metadata including project website, description, author and others should be entered in Plugin.props
and plugins.xml
.
Warning
The only place that currently needs to be updated manually is theRIDER_PLUGIN_ID
inREADME.md
, which you'll only get after uploading your Rider plugin the first time.
This repository contains a few sample projects for various extension points:
- Actions
- Code Inspections
- Code Vision
- Inlay Hints
- Notifications
- Option Pages
- Postfix Templates
- Rd Protocol
- Settings Provider
For general development, there are a couple of scripts/invocations worth knowing. Most importantly, to run and debug your plugin, invoke:
# For Rider
gradlew :runIde
# For ReSharper (VisualStudio)
powershell .\runVisualStudio.ps1
If your Rider plugin requires a model to share information between ReSharper backend and IntelliJ frontend, there is a sample protocol defined in protocol
directory. To generate the Kotlin and C# implementation, call:
gradlew :rdgen
Debbuging your plugin requires your debugger to be attached to the corresponding IDE process. You can find the correct process by searching for Backend
when running your extension in Rider, or devenv
for Visual Studio. Read more about attaching here:
Opening the solution in Rider or IntelliJ IDEA will automatically provide the corresponding run configurations:
There are a couple of version identifiers that should always be updated synchronously:
- The
ProductVersion
variable in build.gradle is responsible for download a certain Rider frontend distribution - The
SdkVersion
property in Plugin.props will affect the referencedJetBrains.ReSharper.SDK
NuGet package and will also determine thewave
version that is required for the Extension Manager in ReSharper - The
runVisualStudio.ps1
script will always download the latest available installer for ReSharper - this can be either a normal release or early-access-program (EAP) release
Available versions are listed here for ReSharper and Rider (under com.jetbrains.intellij.rider
).
Installing ReSharper and the plugin into an experimental Visual Studio instance (hive) affects the following directories:
%LOCALAPPDATA%/JetBrains/plugins
contains a copy of the plugin package, similar to the global NuGet package cache%LOCALAPPDATA%/JetBrains/Installations
contains settings directories per experimental instance, whereaspackages.config
defines what plugins should be installed%APPDATA%/JetBrains/ReSharperPlatformVs[version]
contains binary directories per experimental instance with all assemblies to run ReSharper and the plugin
Using attached folders can be of great help to track these directories while developing a ReSharper plugin.
Both plugins can be published by calling:
# For Rider & ReSharper (Gradle)
gradlew :publishPlugin -PPluginVersion=<version> -PPublishToken=<token>
# For ReSharper (PowerShell)
powershell ./publishPlugin.ps1 -Version <version> -ApiKey <ApiKey>
Warning
The first deployment must be done through the marketplace.