Visual Studio Code
The official LUMOS extension for Visual Studio Code provides a complete development experience for .lumos schema files.
Installation
Section titled “Installation”From VS Code Marketplace (Recommended)
Section titled “From VS Code Marketplace (Recommended)”- Open VS Code
- Press
Ctrl+Shift+X(Windows/Linux) orCmd+Shift+X(macOS) - Search for “LUMOS”
- Click Install
Or install from the command line:
code --install-extension getlumos.lumosMarketplace Link: LUMOS - Visual Studio Marketplace
From VSIX File
Section titled “From VSIX File”For offline installation or specific versions:
# Download latest .vsix from GitHub releasescurl -LO https://github.com/getlumos/vscode-lumos/releases/latest/download/lumos.vsix
# Install in VS Codecode --install-extension lumos.vsixFeatures
Section titled “Features”Syntax Highlighting
Section titled “Syntax Highlighting”Full syntax highlighting for .lumos files:
- Keywords:
struct,enum,type,mod,use,pub,import,from - Types:
u8-u128,i8-i128,bool,String,PublicKey,Signature - Attributes:
#[solana],#[account],#[deprecated] - Comments: Line (
//) and block (/* */)
IntelliSense
Section titled “IntelliSense”Smart code completion for:
- Type names (primitives, Solana types, user-defined)
- Attribute suggestions
- Field type completion
- Enum variant suggestions
Real-time Diagnostics
Section titled “Real-time Diagnostics”Instant error detection as you type:
Error: Undefined type 'InvalidType' --> schema.lumos:5:12 |5 | field: InvalidType, | ^^^^^^^^^^^ type not definedQuick Fixes
Section titled “Quick Fixes”Automatic suggestions to fix common issues:
- Missing semicolons
- Undefined type references
- Invalid attribute combinations
Code Snippets
Section titled “Code Snippets”Built-in snippets for common patterns:
| Prefix | Description |
|---|---|
struct | Solana account struct |
enum | Solana enum definition |
acc | Account struct with common fields |
type | Type alias |
deprecated | Deprecated field attribute |
Example usage: Type struct and press Tab:
#[solana]#[account]struct ${1:Name} { ${2:field}: ${3:Type},}Format on Save
Section titled “Format on Save”Auto-format .lumos files on save (if enabled in VS Code settings).
Commands
Section titled “Commands”Access LUMOS commands via Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
| Command | Description |
|---|---|
LUMOS: Generate Code | Generate Rust/TypeScript from current file |
LUMOS: Validate Schema | Validate current schema |
LUMOS: Show Version | Display installed LUMOS version |
Configuration
Section titled “Configuration”Settings
Section titled “Settings”Configure the extension in VS Code settings (settings.json):
{ // Path to lumos CLI (auto-detected if on PATH) "lumos.cliPath": "lumos",
// Enable real-time diagnostics "lumos.diagnostics.enable": true,
// Enable format on save for .lumos files "lumos.format.onSave": true,
// Default output directory for generation "lumos.generate.outputDir": "./generated",
// Target languages for generation "lumos.generate.languages": ["rust", "typescript"],
// Show inline hints for type sizes "lumos.inlayHints.showSizes": false}File Associations
Section titled “File Associations”The extension automatically associates .lumos files. To add additional patterns:
{ "files.associations": { "*.lumos": "lumos", "*.schema": "lumos" }}Requirements
Section titled “Requirements”Required
Section titled “Required”- VS Code 1.75.0 or higher
Optional (for full functionality)
Section titled “Optional (for full functionality)”-
LUMOS CLI - For code generation commands
Terminal window cargo install lumos-cli# ornpm install -g @getlumos/cli -
LSP Server - For advanced IntelliSense (automatically bundled)
Troubleshooting
Section titled “Troubleshooting”Extension not activating
Section titled “Extension not activating”- Check file extension is
.lumos - Reload VS Code window (
Ctrl+Shift+P→ “Developer: Reload Window”) - Check Output panel for errors (
View→Output→ select “LUMOS”)
Diagnostics not showing
Section titled “Diagnostics not showing”- Verify
lumos.diagnostics.enableistrue - Check LUMOS CLI is installed and on PATH:
Terminal window lumos --version - Check LSP server is running (see Output panel)
Code generation fails
Section titled “Code generation fails”- Ensure LUMOS CLI is installed
- Check schema has valid syntax first:
Terminal window lumos validate schema.lumos - Verify output directory exists and is writable
IntelliSense not working
Section titled “IntelliSense not working”- Wait for LSP server to initialize (check status bar)
- Try restarting the LSP:
Ctrl+Shift+P→ “LUMOS: Restart Language Server” - Check for conflicting extensions
Keyboard Shortcuts
Section titled “Keyboard Shortcuts”| Shortcut | Action |
|---|---|
Ctrl+Shift+B | Generate code from current file |
F5 | Validate current schema |
Ctrl+Space | Trigger IntelliSense |
Custom Keybindings
Section titled “Custom Keybindings”Add to keybindings.json:
[ { "key": "ctrl+alt+g", "command": "lumos.generateCode", "when": "editorLangId == lumos" }]Multi-root Workspaces
Section titled “Multi-root Workspaces”The extension works in multi-root workspaces. Each workspace folder can have its own LUMOS configuration.
Related Resources
Section titled “Related Resources”Changelog
Section titled “Changelog”See the extension changelog for version history.