ron-lsp

Crates.ioron-lsp
lib.rsron-lsp
version0.1.2
created_at2025-10-28 00:52:15.051004+00
updated_at2025-12-25 05:23:37.596624+00
descriptionAn LSP and cli for RON files that provides autocomplete, diagnostics, go to definition, code actions, and hover support based on Rust type annotations
homepage
repositoryhttps://github.com/jasonjmcghee/ron-lsp
max_upload_size
id1903941
size322,062
Jason McGhee (jasonjmcghee)

documentation

README

ron-lsp

Crates.io License Visual Studio Marketplace Badge JetBrains Plugin Version

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>]

Screenshot 2025-10-24 at 9 59 22 AM

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:

Screenshot 2025-10-24 at 10 02 35 AM

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:

  1. Parse the @[crate::models::User] annotation
  2. Find the User struct in your Rust project
  3. Extract field names, types, and documentation
  4. Provide autocomplete and validation
  5. Support Default trait for optional field omission
  6. 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,
)
Screenshot 2025-10-24 at 5 52 13 PM

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

  1. Type annotation in RON file

  2. 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

OR

  • cd vscode-extensions and package by running npm install and vsce package

Then, either ensure 'ron-lsp' is in your PATH or update .vscode/settings.json:

{
  ...
  "ronLsp.serverPath": "/path/to/ron-lsp"
}

Visual Studio Marketplace Badge

JetBrains

Make sure you already did cargo install ron-lsp.

Either:

OR

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.

JetBrains Plugin Version

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.

Commit count: 0

cargo fmt