Using LUMOS with IntelliJ IDEA
Use LUMOS in IntelliJ IDEA, Rust Rover, and CLion with full language support including syntax highlighting, auto-completion, and real-time diagnostics.
Why Use IntelliJ Plugin?
Section titled “Why Use IntelliJ Plugin?”- ✅ File Type Recognition -
.lumosfiles automatically recognized - ✅ LSP Integration - Full language server protocol support
- ✅ Auto-Completion - Smart suggestions for types and attributes
- ✅ Real-Time Diagnostics - Instant error detection
- ✅ Hover Documentation - Inline type information
- ✅ Multi-IDE Support - Works with IntelliJ IDEA, Rust Rover, and CLion
Prerequisites
Section titled “Prerequisites”1. Install LUMOS Language Server
Section titled “1. Install LUMOS Language Server”The plugin requires the LUMOS Language Server (lumos-lsp) to provide IDE features.
# Install via Cargocargo install lumos-lsp
# Verify installationlumos-lsp --version# Output: lumos-lsp 0.1.12. Minimum IDE Version
Section titled “2. Minimum IDE Version”- IntelliJ IDEA Community - 2024.1 or higher
- IntelliJ IDEA Ultimate - 2024.1 or higher
- Rust Rover - 2024.1 or higher
- CLion - 2024.1 or higher
Check your IDE version: Help → About
Installation
Section titled “Installation”Option 1: From JetBrains Marketplace (Coming Soon)
Section titled “Option 1: From JetBrains Marketplace (Coming Soon)”1. Open: Settings → Plugins (Cmd+, → Plugins)2. Search: "LUMOS" in Marketplace tab3. Click: Install4. Restart IDEOption 2: Manual Installation
Section titled “Option 2: Manual Installation”-
Download the latest release:
- Visit: github.com/getlumos/intellij-lumos/releases
- Download:
intellij-lumos-X.X.X.zip
-
Install from disk:
Settings → Plugins → ⚙️ (Settings icon) → Install Plugin from DiskSelect: intellij-lumos-X.X.X.zipClick: OK → Restart IDE
Quick Start
Section titled “Quick Start”1. Create a .lumos file
Section titled “1. Create a .lumos file”#[solana]#[account]struct Player { wallet: PublicKey, score: u64, level: u16,}2. IDE Features Activate Automatically
Section titled “2. IDE Features Activate Automatically”- ✅ Syntax highlighting - Keywords, types, attributes color-coded
- ✅ Auto-completion - Type
Pub→ suggestsPublicKey - ✅ Error detection - Invalid syntax shows red squiggles
- ✅ Hover info - Hover over types to see documentation
3. Generate Code
Section titled “3. Generate Code”Open terminal in IDE:
lumos generate player.lumos
# Output:# ✓ Generated player.rs# ✓ Generated player.tsFeatures
Section titled “Features”Syntax Highlighting
Section titled “Syntax Highlighting”Keywords, types, and attributes are automatically highlighted:
- Keywords:
struct,enum,pub - Attributes:
#[solana],#[account],#[version] - Types:
PublicKey,u64,Vec,Option - Comments:
//and/* */
Auto-Completion
Section titled “Auto-Completion”Press Ctrl+Space for intelligent suggestions:
Solana Types:
PublicKey- Solana public key (32 bytes)Signature- Transaction signature
Primitive Types:
u8,u16,u32,u64,u128i8,i16,i32,i64,i128bool,String
Complex Types:
Vec<T>- Dynamic arrayOption<T>- Optional value
Attributes:
#[solana]- Mark as Solana-specific#[account]- Anchor account marker#[version(N)]- Schema version
Real-Time Diagnostics
Section titled “Real-Time Diagnostics”Errors appear instantly as you type:
Example - Undefined type:
struct Player { item: UnknownType // ← Red squiggle: "Undefined type 'UnknownType'"}Example - Missing attribute:
struct Player { // ← Yellow warning: "Consider adding #[solana] attribute" wallet: PublicKey,}Hover Documentation
Section titled “Hover Documentation”Hover over any type or field to see inline documentation:
struct Player { wallet: PublicKey // ← Hover shows: "Solana public key (32 bytes)" // Used for account addresses}Configuration
Section titled “Configuration”LSP Server Path
Section titled “LSP Server Path”The plugin automatically detects lumos-lsp. If you need to specify a custom path:
1. Open: Settings → Languages & Frameworks → Language Servers2. Find: LUMOS Language Server3. Set custom path: /path/to/lumos-lsp4. Click: OKEnable/Disable LSP
Section titled “Enable/Disable LSP”Settings → Languages & Frameworks → Language Servers→ LUMOS Language Server → Enable/DisableTroubleshooting
Section titled “Troubleshooting”LSP Server Not Starting
Section titled “LSP Server Not Starting”Symptom: No auto-completion or diagnostics appear
Diagnosis:
# Check if lumos-lsp is installedwhich lumos-lsp
# If not found, install itcargo install lumos-lsp
# Verify versionlumos-lsp --versionFix:
- Ensure
lumos-lspis in PATH or~/.cargo/bin/ - Restart IDE:
File → Invalidate Caches → Invalidate and Restart - Check IDE logs:
Help → Show Log in Finder→ Search for “lumos”
Plugin Not Recognized
Section titled “Plugin Not Recognized”Symptom: Can’t find LUMOS in installed plugins
Fix:
- Verify IDE version is 2024.1 or higher:
Help → About - Install LSP4IJ dependency:
Settings → Plugins → Marketplace → Search "LSP4IJ" → Install
- Reinstall LUMOS plugin
- Restart IDE
File Type Not Recognized
Section titled “File Type Not Recognized”Symptom: .lumos files open as plain text
Fix:
- Right-click
.lumosfile - Select: Associate with File Type
- Choose: LUMOS
- Restart IDE
Syntax Highlighting Not Working
Section titled “Syntax Highlighting Not Working”Fix:
- Check color scheme:
Settings → Editor → Color Scheme - Verify plugin is enabled:
Settings → Plugins → Installed → LUMOS (✓) - Reload file:
File → Reload All from Disk
Keyboard Shortcuts
Section titled “Keyboard Shortcuts”| Action | Windows/Linux | macOS |
|---|---|---|
| Auto-completion | Ctrl+Space | Cmd+Space |
| Show documentation | Ctrl+Q | Ctrl+J |
| Go to definition | Ctrl+B | Cmd+B |
| Find usages | Alt+F7 | Opt+F7 |
| Reformat code | Ctrl+Alt+L | Cmd+Opt+L |
Example Workflow
Section titled “Example Workflow”1. Create Schema
Section titled “1. Create Schema”#[solana]#[account]struct TokenVault { authority: PublicKey, mint: PublicKey, amount: u64, created_at: i64,}
#[solana]enum VaultStatus { Active, Frozen, Closed,}2. Generate Code
Section titled “2. Generate Code”Open terminal in IDE (Alt+F12 / Opt+F12):
lumos generate token-vault.lumos
# Output:# ✓ Generated token-vault.rs# ✓ Generated token-vault.ts3. Use Generated Code
Section titled “3. Use Generated Code”Rust (Anchor program):
use crate::TokenVault;
#[program]pub mod token_vault { pub fn initialize(ctx: Context<Initialize>, amount: u64) -> Result<()> { let vault = &mut ctx.accounts.vault; vault.authority = ctx.accounts.authority.key(); vault.amount = amount; Ok(()) }}TypeScript (Client):
import { TokenVault } from './token-vault';
const vault = await program.account.tokenVault.fetch(vaultPubkey);console.log(`Vault amount: ${vault.amount}`);IDE-Specific Tips
Section titled “IDE-Specific Tips”IntelliJ IDEA
Section titled “IntelliJ IDEA”Project Structure:
my-solana-project/├── schemas/│ └── vault.lumos├── programs/│ └── src/│ └── lib.rs└── client/ └── src/ └── index.tsRun Configuration:
Run → Edit Configurations → + → Shell ScriptName: Generate LUMOSScript: lumos generate schemas/vault.lumosWorking directory: $PROJECT_DIR$Rust Rover
Section titled “Rust Rover”Cargo Integration:
[build-dependencies]# Add script to run lumos generate before buildBuild Script:
Tools → External Tools → + → AddName: LUMOS GenerateProgram: lumosArguments: generate $FilePath$Working directory: $ProjectFileDir$Similar to Rust Rover, use External Tools for LUMOS commands.
Next Steps
Section titled “Next Steps”- CLI Commands Reference - Learn all LUMOS commands
- Type System - Understand LUMOS types
- Generated Code - Working with generated files
- GitHub Repository - Report issues or contribute
Supported IDEs
Section titled “Supported IDEs”| IDE | Version | Status |
|---|---|---|
| IntelliJ IDEA Community | 2024.1+ | ✅ Fully Supported |
| IntelliJ IDEA Ultimate | 2024.1+ | ✅ Fully Supported |
| Rust Rover | 2024.1+ | ✅ Fully Supported |
| CLion | 2024.1+ | ✅ Fully Supported |
Related
Section titled “Related”- VS Code Extension - Setup guide for VS Code
- npm Package Guide - Using LUMOS in JavaScript/TypeScript projects
- Installation Guide - Install LUMOS CLI
Questions or issues? Open an issue on GitHub