Editor support for MIDL, the Mikros interface definition language (MIKSPEC-0024). It lives outside the mikros repository on purpose: MIKSPEC-0023 makes editor integrations a non-goal there.
| Path | What it is |
|---|---|
server/ |
midl-lsp, the language server, built on midlc's analysis API |
tree-sitter-midl/ |
Tree-sitter grammar and highlight query (used by Zed) |
editors/zed/ |
Zed extension: the grammar, queries, and a shim that starts midl-lsp |
editors/textmate/ |
TextMate bundle (used by JetBrains IDEs; also VS Code's layout) |
editors/jetbrains/ |
Plugin for JetBrains IDEs (IntelliJ IDEA, RustRover, CLion, ...), 2025.2 and later |
It provides these features:
- diagnostics from every parse and check error
- go to definition and find references
- hover with the kind, the full name and the doc comments
- document outline and workspace symbols
- completion: keywords, built-in types, the names in scope, the
declarations of a qualified library, and object types and rights inside
handle<...> - rename for declarations, members, methods and parameters (not for libraries or enum and bits members; see the limits below)
It reads every .midl file under the workspace folders, then overlays
the open buffers. It reruns midlc::analysis::analyze over all of them
on every change, because libraries in different folders use each other.
A file opened outside every workspace folder brings in its own folder.
If that folder is named after a library, such as mikros.fs, the
folders next to it come in too.
cargo build --release # target/release/midl-lsp
cargo install --path server # or put it in ~/.cargo/bin
cargo testUntil the midlc tooling commits are pushed, server/Cargo.toml uses the
mikros checkout next to this repository (../mikros). Cargo builds
midlc into this repository's target/ and never into mikros's. After
they are pushed, switch to the git dependency in the comment there.
- A lexical error, such as a bad integer or an unterminated string, stops the analysis of that file.
- A declaration that fails to parse disappears from the index, along with all of its members. Names that use it get a "not declared" error.
- Uses of enum and bits members in constants are not indexed, so those members cannot be renamed and their references are not found.
- Diagnostics are points in midlc. The server widens each one to the token at that point.
Zed builds the grammar from a git commit, so editors/zed/extension.toml
has to name a commit that contains tree-sitter-midl/. For local
development:
- Commit the repository.
- In
extension.toml, set[grammars.midl]as follows:repository = "file:///path/to/midl-lsp"(this checkout)rev= that commit's hash
- In Zed, run
zed: install dev extensionand pickeditors/zed. - Put
midl-lspon thePATH, or set it in Zed's settings:{"lsp": {"midl-lsp": {"binary": {"path": "/path/to/midl-lsp"}}}}.
After editing tree-sitter-midl/grammar.js:
cd tree-sitter-midl && npx tree-sitter-cli@0.25.10 generate
scripts/sync-queries.sh # copies highlights.scm into the Zed extensionThe plugin works in any JetBrains IDE from 2025.2 on that has the
built-in LSP client (IntelliJ IDEA, RustRover, CLion, PyCharm, and so
on). Highlighting comes from the TextMate bundle in editors/textmate,
which ships next to the plugin's jar.
Gradle builds against a locally installed IDE, so nothing has to be downloaded. It looks for one, 2025.2 or later, in the usual install folders:
| OS | Folders searched |
|---|---|
| macOS | /Applications, ~/Applications |
| Linux | Toolbox (~/.local/share/JetBrains/Toolbox/apps), /opt, /opt/jetbrains, /usr/local, /usr/share, /usr/lib, /snap |
| Windows | %ProgramFiles%\JetBrains, %LOCALAPPDATA%\Programs, Toolbox (%LOCALAPPDATA%\JetBrains\Toolbox\apps) |
If it finds several, it takes IntelliJ IDEA first, then RustRover,
CLion, GoLand, PyCharm, WebStorm, and the others, and the newest build
of that product. To choose one yourself, set platformPath to its
install folder, with -PplatformPath=... or in
~/.gradle/gradle.properties.
Gradle needs JDK 21 or later. Any JDK works, including the JetBrains
Runtime bundled with the IDE (<ide>/jbr, or
<ide>.app/Contents/jbr/Contents/Home on macOS):
cd editors/jetbrains
export JAVA_HOME=/path/to/jdk-21
./gradlew runIde # a sandboxed IDE with the plugin
./gradlew buildPlugin # build/distributions/midl-jetbrains-0.1.0.ziprunIde starts the IDE that was found or named. The zip from
buildPlugin installs into any supported IDE, not only that one.
To install the zip, go to Settings | Plugins | ⚙ | Install Plugin from Disk. The plugin finds the server in this order:
- the path set in Settings | Languages & Frameworks | MIDL
midl-lspon thePATH~/.cargo/bin/midl-lsp