Skip to content

misonijnik/fsharp-support

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

F# language support in JetBrains Rider

JetBrains official project Join the chat at https://gitter.im/JetBrains/fsharp-support

F# support in Rider is implemented as a plugin made of two major components:

  • ReSharper.Host plugin (referred to as the backend) that adds F# support to ReSharper and is implemented in ReSharper.FSharp solution. ReSharper.Host is a modification of ReSharper used as a language service that the IntelliJ Platform interacts with. The backend is written in C# and F#.
  • IntelliJ Platform plugin for Rider (referred to as the frontend) that defines F# as a new IntelliJ Platform language but delegates most of the work to the backend. This part also adds F# Interactive support. The frontend is written in Kotlin.

F# support in Rider makes use of open source software, most notably FSharp.Compiler.Service and Fantomas.

Building the plugin

Requirements

Optional

Building the plugin and launching Rider in a sandbox

  1. Install SDK and prepare backend plugin build using Gradle

    • if using IntelliJ IDEA:

      Open the rider-fsharp project in IntelliJ IDEA. When suggested to import Gradle projects, accept the suggestion: Gradle will download Rider SDK and set up all necessary dependencies. rider-fsharp uses the gradle-intellij-plugin Gradle plugin that downloads the IntelliJ Platform SDK, packs the F# plugin and installs it into a sandboxed IDE or its test shell, which allows testing the plugin in a separate environment.

      Open the Gradle tool window in IntelliJ IDEA (View | Tool Windows | Gradle), and execute the rider-fsharp/prepare task.

    • if using Gradle command line:

      $ cd ./rider-fsharp
      $ ./gradlew prepare
      
  2. Open ReSharper.FSharp.sln solution and build using the Debug configuration. The output assemblies are later copied to the frontend plugin directories by Gradle. (If you're seeing build errors in Rider, choose File | Settings | Build, Execution, Deployment | Toolset and Build, and in the Use MSBuild version drop-down, make sure that Rider uses MSBuild shipped with .NET Core SDK.)

  3. Launch Rider with the plugin installed

    • if using IntelliJ IDEA:

      Open the Gradle tool window in IntelliJ IDEA (View | Tool Windows | Gradle), and execute the intellij/runIde task. This will build the frontend, install the plugin to a sandbox, and launch Rider with the plugin.

    • if using Gradle command line:

      $ ./gradlew runIde
      

Installing to an existing Rider instance

  1. Build the Debug configuration in ReSharper.FSharp.sln.
  2. Execute the buildPlugin Gradle task.
  3. Install the plugin (rider-fsharp/build/distributions/*.zip) to your Rider installation from disk.

Contributing

We welcome contributions that address any F# plugin issues that are open in Rider's issue tracker. Some of these issues are marked as Up for grabs: we expect issues tagged this way to be easier addressed by external contributors as they are unlikely to require any changes outside the F# plugin. Note that some issues are marked as third-party problems, and addressing them requires fixes from FCS or other projects that this plugin depends on.

If you are willing to work on an issue, please leave a comment under the issue. Doing this will make sure that the team doesn't start working on the same issue, and help you get any necessary assistance.

New code is usually written in F#, except for the FSharp.Psi project that is written in C#.

As soon as you are done with changes in your fork, please open a pull request for review.

Note that the public CI server is not set up at this point but it's going to be available shortly.

The project currently lacks a solid test suite. There's currently no requirement to add new tests, but as soon as more functionality is covered, adding new tests along with code changes will become necessary for a PR to be accepted.

We suggest that you read docs on the two SDKs that this plugin uses:

Development notes

master is currently the main development branch, and builds from this branch are bundled with nightly Rider 2018.2 builds available via JetBrains Toolbox App when 2018.2 nightlies become public. 2018.1.x updates are built using wave12 branch. When preparing a release or EAP build, changes are cherry-picked to the corresponding release branch like wave10-rider-release.

By default, the project depends on nightly SDK builds, but a specific SDK version can be referenced in rider-fsharp/build.gradle if necessary.

To update to the latest frontend SDK, run the intellij/prepare Gradle task in IntelliJ IDEA which will download both Rider SDK and ReSharper SDK. To restore ReSharper SDK in projects run Tools | NuGet | NuGet Force Restore in Rider. The force restore is currently needed for floating package versions like 2017.3-SNAPSHOT* (RIDER-11395).

To debug the backend, attach to the ReSharper.Host process launched via the runIde Gradle task. To debug the frontend, start the runIde task in Debug mode.

Rider's JVM-based frontend and .NET-based backend communicate using RdProtocol with APIs available on both sides. For backend-frontend communication in plugins, RdProtocol should be used as well. Protocol model is defined in this file.

Known issues

As soon as you build the backend for the first time, Rider will show false red code warnings across the backend's F# projects. This is due to a bug in Rider waiting to be fixed (RIDER-11392). As a workaround, you can unload all projects in ReSharper.FSharp.sln, and then reload them.

Roadmap

  • Cover more functionality with tests, e.g. add tests for mapping FCS representations to ReSharper for declared elements and types.
  • Set up a public Continuous Integration server for test runs.
  • Enable development on macOS and Linux.

About

F# support in JetBrains Rider

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • F# 44.0%
  • C# 36.8%
  • Kotlin 12.9%
  • Lex 4.3%
  • Java 2.0%
  • HTML 0.0%