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!
- 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.
For each feature:
- Enable via LSP (one-line XML)
- Evaluate — what works? what's missing?
- Build native PSI replacement when needed
- 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.
- 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-detectbutton for common install locations npx rescript watchrunning in your project — the language server needs the compiler's.cmtoutput to provide diagnostics and completions
Search for "ReScript IDE" in your IDE's plugin settings, or install from the JetBrains Marketplace.
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.
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.
- intellij-elm — the gold
standard; full native implementation with rich editor features. Local copy
at
~/code/github.com/elm-tooling/intellij-elm. - intellij-rust — everything
native without LSP (was open-source, now closed-source at JetBrains). Local
copy at
~/code/github.com/intellij-rust/intellij-rust. - intellij-haskell-lsp —
efficient LSP integration approach; architecture template. Local copy at
~/code/github.com/rockofox/intellij-haskell-lsp. - tree-sitter-rescript grammar.js — ~140 rules, ~1,100 lines. Reference for building the GrammarKit BNF.
- ReScript compiler parser (res_core.ml) —
grammar rules embedded as comments (search for
::=). - rescript-vscode — LSP
server source. Local copy at
~/code/github.com/rescript-lang/rescript-vscode. - Custom Language Support Tutorial
./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 issuesUse 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 -wLaunch the next-release sandbox against the same playground:
manage/dev/runIde
IDEA_PROJECT=/absolute/path/to/project manage/dev/runIde./manage/prod/release-pluginFirst release was manual. Plugin ID: 30982.
See https://plugins.jetbrains.com/plugin/30982-rescript-ide.