| Crates.io | ron-lsp |
| lib.rs | ron-lsp |
| version | 0.1.2 |
| created_at | 2025-10-28 00:52:15.051004+00 |
| updated_at | 2025-12-25 05:23:37.596624+00 |
| description | An LSP and cli for RON files that provides autocomplete, diagnostics, go to definition, code actions, and hover support based on Rust type annotations |
| homepage | |
| repository | https://github.com/jasonjmcghee/ron-lsp |
| max_upload_size | |
| id | 1903941 |
| size | 322,062 |
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>]
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.
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:
@[crate::models::User] annotationUser struct in your Rust projectDefault trait for optional field omissionsrc/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"),
)
#[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,
)
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"
Type annotation in RON file
Type declaration in ron.toml, declarations are tested in the order of the file
Expand a section below for editor-specific instructions.
Make sure you already did cargo install ron-lsp.
Either:
OR
.vsix from releasesOR
cd vscode-extensions and package by running npm install and vsce packageThen, either ensure 'ron-lsp' is in your PATH or update .vscode/settings.json:
{
...
"ronLsp.serverPath": "/path/to/ron-lsp"
}
Make sure you already did cargo install ron-lsp.
Either:
OR
.zip from releasesOR :
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.
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.
See their docs on how to add an LSP, you should be able to follow them for this plugin.
Contributions welcome! This is a foundational implementation that can be extended with more features.
MIT (except altered Rust logo svg, see below)
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.