Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

ReScript IDE — IntelliJ Plugin

ReScript language support for JetBrains IDEs (IntelliJ IDEA, WebStorm, etc.).

[!NOTE]

This project's development is heavily AI-assisted. I use an agent in a heavily directed fashion, in a tight TDD loop (manually).

Since this is also a learning project, there are probably lots of places where the code is subpar though. If you know better, don't hesitate to show me a better way!

What this is

  • GrammarKit for parsing/PSI (syntax highlighting, structure view, folding)
  • LSP4IJ for semantic intelligence (completion, navigation, diagnostics)
  • Thin glue code connecting the two

The ReScript LSP (@rescript/language-server) handles the semantic work, with an OCaml-based compiler underneath.

Under active development. The plugin currently relies heavily on the ReScript LSP for semantic features. Over time, the goal is to implement more features natively — possibly even native type inference, as the intellij-elm plugin did for Elm. That's probably a long road though, and this is a learning project as much as a practical tool.

Plugin evolution strategy — LSP first, then native

For each feature:

  1. Enable via LSP (one-line XML)
  2. Evaluate — what works? what's missing?
  3. Build native PSI replacement when needed
  4. IntelliJ automatically prefers native over LSP

The permissive parser lets us start with LSP immediately, then tighten grammar rules only when a native feature demands it.

Feature LSP Native
Code folding (not available) DONE
Structure view DONE (LSP) Future (needs name extraction)
Find usages LSP references Future (PSI resolution)
Rename LSP rename Future (cross-module)
Custom inspections (not available) Future (PSI-based)

See CHANGELOG.md for what's shipped and _tickets/ for what's planned.

Requirements / How to use

  • JetBrains IDE 2025.3+
  • LSP4IJ plugin
  • npm install -g @rescript/language-server
  • Set an explicit executable path in Languages & Frameworks > ReScript
  • The ReScript settings page includes an Auto-detect button for common install locations
  • npx rescript watch running in your project — the language server needs the compiler's .cmt output to provide diagnostics and completions

Installation

Search for "ReScript IDE" in your IDE's plugin settings, or install from the JetBrains Marketplace.

Main alternative

The main JetBrains Marketplace alternative currently is rescript-intellij-plugin.

ReScript IDE is intentionally smaller in scope and is expected to remain that way. It focuses on editor support and LSP-backed language features rather than broader project tooling such as project creation workflows.

It also differs architecturally:

  • it relies heavily on LSP4IJ to provide semantic features through LSP;
  • it uses GrammarKit/JFlex rather than a handwritten parser;
  • it is currently power-user oriented: you are expected to manage your own environment, configure explicit tool paths, and keep a compiler/watch process running outside the IDE.

This is also a learning project.

Contributions

LLM-assisted contributions are welcome. This codebase already uses LLMs as learning and implementation tools, but any such changes are expected to be heavily human-directed, understood, reviewed, documented, and tested.

In practice that means contributors should understand the change they're submitting and be able to discuss it during review.

Inspiration and reference material

Development

Build and run locally

./manage/dev/buildPlugin          # build the plugin zip
./manage/dev/runIde               # launch a sandboxed IDE on the playground
./gradlew test                    # run the test suite
./gradlew verifyPluginProjectConfiguration   # catch plugin.xml issues

Manual IDE comparison setup

Use rescript-playground-example/ as the shared manual smoke-test project. There are two useful IDEs:

  • Host IDE — your normal IntelliJ workspace, with the released/baseline ReScript IDE plugin installed from Marketplace.
  • Sandbox IDE — launched by manage/dev/runIde, with the plugin built from this working tree.

For the host IDE, install/enable:

  • ReScript IDE (com.github.benjamin_thomas.intellij_rescript).
  • LSP4IJ.
  • Multi-Project Workspace if you want the plugin repo and playground visible in one frame.

Recommended host workspace:

intellij-rescript-workspace
  intellij-rescript
    rescript-playground-example [rescript-playground]

The playground may appear visually nested because it physically lives inside the plugin repo; the [rescript-playground] suffix shows it is loaded as its own workspace project. Do not mark the playground root as excluded. Exclude only generated children such as node_modules/, lib/, and *.res.mjs if needed.

Configure the host IDE under Languages & Frameworks > ReScript with explicit paths to node and rescript-language-server, then run a ReScript watcher in the playground:

cd rescript-playground-example
npm install
npx rescript build -w

Launch the next-release sandbox against the same playground:

manage/dev/runIde
IDEA_PROJECT=/absolute/path/to/project manage/dev/runIde

Publishing

./manage/prod/release-plugin

First release was manual. Plugin ID: 30982. See https://plugins.jetbrains.com/plugin/30982-rescript-ide.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages