4 releases
| 0.1.3 | Feb 27, 2026 |
|---|---|
| 0.1.2 | Dec 25, 2025 |
| 0.1.1 | Oct 28, 2025 |
| 0.1.0 | Oct 28, 2025 |
#113 in Procedural macros
430KB
10K
SLoC
ron-lsp
Type validation for .ron files (in or out of the ide)
An LSP for RON files that provides autocomplete, diagnostics, go to definition, code actions, and hover support based on Rust type annotations. It can also be used to check in bulk via CLI, optionally with a path. ron-lsp check [<path>]
Getting started
Install:
cargo install ron-lsp
Add comment annotations to the top of .ron files like /* @[crate::models::User] */.
And then use the cli (from a rust project working directory):
ron-lsp check
It'll output something like this if there are warnings / errors:
You can optionally pass a file or folder. (e.g. ron-lsp check crates/sub-crate - it will recursively check all .ron files from that point.)
It will use the nearest Cargo.toml starting from the resolved .ron file.
Usage
Type Annotation Format
At the top of your RON file, add a block comment with the type annotation:
/* @[crate::models::User] */
User(
id: 1,
name: "Alice",
email: "alice@example.com",
age: 30,
)
The LSP will:
- Parse the
@[crate::models::User]annotation - Find the
Userstruct in your Rust project - Extract field names, types, and documentation
- Provide autocomplete and validation
- Support
Defaulttrait for optional field omission - Provide code actions for inserting either required or missing fields, when applicable
Example
src/models/user.rs:
pub struct User {
pub id: u32,
pub name: String,
pub email: String,
pub age: u32,
pub bio: Option<String>,
}
data/users.ron:
/* @[crate::models::User] */
User(
id: 1,
name: "Alice",
email: "alice@example.com",
age: 30,
bio: Some("Software developer"),
)
Example with Defaults
#[derive(Default, Serialize, Deserialize)]
pub struct Config {
pub host: String,
pub port: u16,
pub max_connections: u32,
pub debug: bool,
pub api_key: Option<String>,
pub allowed_origins: Vec<String>,
}
/* @[crate::models::Config] */
Config(
// This Config struct has #[derive(Default)]
// So we can omit fields and they will use their default values
// The LSP should NOT show warnings for missing fields
port: 8080,
debug: true,
)
ron.toml configuration
You can configure default type mappings for RON files using an optional ron.toml file at your project root (next to Cargo.toml).
This lets you omit the Type Annotation in RON files whose paths match a glob pattern which is useful if you have multiple files with the same type (e.g., bevy assets).
Example:
[[types]]
# Matches all files named `post.ron`
glob = "**/post.ron"
# Fully qualified type name
type = "crate::models::Post"
[[types]]
# Matches all files ron files in the `config` directory
glob = "**/config/*.ron"
type = "crate::models::Config"
[[types]]
# Matches all files ending with .user.ron
glob = "**/*.user.ron"
type = "crate::models::User"
Precedence
- Type annotation in RON file
- Type declaration in ron.toml, declarations are tested in the order of the file
Editor Integration
Expand a section below for editor-specific instructions.
VSCode
Make sure you already did cargo install ron-lsp.
Either:
OR
- Grab
.vsixfrom releases
OR
cd vscode-extensionsand package by runningnpm installandvsce package
Then, either ensure 'ron-lsp' is in your PATH or update .vscode/settings.json:
{
...
"ronLsp.serverPath": "/path/to/ron-lsp"
}
JetBrains
Make sure you already did cargo install ron-lsp.
Either:
OR
- Grab
.zipfrom releases
OR :
cd jetbrains-plugin
./gradlew buildPlugin
And "Install Plugin from Disk" and choose the zip.
Then, either ensure 'ron-lsp' is in your PATH or update "Server path" in Settings > Tools > RON LSP.
Neovim
Make sure you already did cargo install ron-lsp.
Ensure you already have nvim-lspconfig.
Note: If you don't want ron-lsp in your path, replace with the absolute path.
Add ron.lua to ~/.config/nvim/lua/plugins/ron.lua.
Other editors (e.g. Zed / Helix)
See their docs on how to add an LSP, you should be able to follow them for this plugin.
Contributing
Contributions welcome! This is a foundational implementation that can be extended with more features.
License
MIT (except altered Rust logo svg, see below)
Attribution
The logo used in the Jetbrains plugin is a colorized version of the Rust logo which is CC-BY 4.0. See Rust logo specific trademark policy for additional details.
Dependencies
~16–25MB
~355K SLoC