Skip to content

Latest commit

 

History

History
104 lines (67 loc) · 5.67 KB

README.md

File metadata and controls

104 lines (67 loc) · 5.67 KB

JetBrains incubator project

Plugin Template for ReSharper and Rider

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.

Getting Started

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 the RIDER_PLUGIN_ID in README.md, which you'll only get after uploading your Rider plugin the first time.

Samples

This repository contains a few sample projects for various extension points:

Development

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:

Version Relevant Code

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 referenced JetBrains.ReSharper.SDK NuGet package and will also determine the wave 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).

Visual Studio / ReSharper Relevant Directories

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, whereas packages.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.

Deployment

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.