lumos-lsp

Crates.iolumos-lsp
lib.rslumos-lsp
version0.3.0
created_at2025-11-22 22:28:38.619886+00
updated_at2025-12-08 23:15:58.097426+00
descriptionLanguage Server Protocol implementation for LUMOS schema language
homepage
repositoryhttps://github.com/getlumos/lumos
max_upload_size
id1945827
size98,364
Thę Rēct◎r (rz1989s)

documentation

README

lumos-lsp

Language Server Protocol (LSP) implementation for LUMOS schema language.

Overview

lumos-lsp provides IDE features for .lumos files across all LSP-compatible editors:

  • Diagnostics - Real-time syntax errors and type validation
  • Auto-completion - Solana types, primitives, attributes, keywords
  • Hover information - Type definitions and documentation
  • Formatting - Consistent code style (coming soon)

Installation

From crates.io

cargo install lumos-lsp

From source

git clone https://github.com/getlumos/lumos.git
cd lumos
cargo install --path packages/lsp

Editor Setup

VS Code

The LUMOS VSCode extension uses this LSP server automatically. Just install the extension.

Neovim

Add to your init.lua:

require'lspconfig'.lumos.setup{
  cmd = {"lumos-lsp"},
  filetypes = {"lumos"},
  root_dir = require'lspconfig'.util.root_pattern(".git", "Cargo.toml"),
}

Emacs (lsp-mode)

Add to your Emacs config:

(add-to-list 'lsp-language-id-configuration '(lumos-mode . "lumos"))

(lsp-register-client
 (make-lsp-client :new-connection (lsp-stdio-connection "lumos-lsp")
                  :major-modes '(lumos-mode)
                  :server-id 'lumos-lsp))

Sublime Text

  1. Install LSP package
  2. Add to LSP settings:
{
  "clients": {
    "lumos": {
      "enabled": true,
      "command": ["lumos-lsp"],
      "selector": "source.lumos"
    }
  }
}

Features

Diagnostics

Real-time error detection:

// ❌ Syntax error
struct Account {
    invalid syntax
}

// ❌ Undefined type
struct Player {
    inventory: UndefinedType,  // Error: Type 'UndefinedType' is not defined
}

// ✅ Valid
#[solana]
struct Account {
    owner: PublicKey,
    balance: u64,
}

Auto-completion

Smart completions for:

  • Solana types: PublicKey, Signature, Keypair
  • Primitives: u8-u128, i8-i128, bool, String, f32, f64
  • Complex types: Vec<T>, Option<T>
  • Attributes: #[solana], #[account], #[key], #[max(n)], #[deprecated]
  • Keywords: struct, enum

Hover Information

Hover over types to see documentation:

owner: PublicKey  // Hover shows: "Solana public key (32 bytes)"
balance: u64      // Hover shows: "64-bit unsigned integer, Range: 0 to 18,446,744,073,709,551,615"

Architecture

Editor (VS Code, Neovim, etc.)
    ↕ JSON-RPC (LSP protocol)
LUMOS Language Server
    ↓ Uses
LUMOS Parser (lumos-core)
    ↓ Produces
Abstract Syntax Tree (AST)

Development

Build

cargo build --package lumos-lsp

Test

cargo test --package lumos-lsp

Run locally

cargo run --package lumos-lsp

The server communicates via stdin/stdout using JSON-RPC.

Logging

Set RUST_LOG environment variable to enable logging:

# Debug level
RUST_LOG=debug lumos-lsp

# Info level
RUST_LOG=info lumos-lsp

# Trace level (very verbose)
RUST_LOG=trace lumos-lsp

Logs are written to stderr (not stdout, which is used for LSP communication).

Project Structure

packages/lsp/
├── Cargo.toml
├── README.md
└── src/
    ├── main.rs              # Binary entry point
    ├── server.rs            # Core LSP server
    └── server/
        ├── diagnostics.rs   # Diagnostics handler
        ├── completion.rs    # Auto-completion
        └── hover.rs         # Hover information

Contributing

Contributions welcome! See the main LUMOS repository for guidelines.

License

Dual-licensed under MIT or Apache 2.0, at your option.

Links


Version: 0.1.0 Status: Alpha - Core features implemented, additional features coming soon

Commit count: 0

cargo fmt