Emacs
The official LUMOS major mode for Emacs provides syntax highlighting and LSP integration via lsp-mode.
Installation
Section titled “Installation”Using MELPA
Section titled “Using MELPA”(use-package lumos-mode :ensure t :hook (lumos-mode . lsp-deferred))Using straight.el
Section titled “Using straight.el”(use-package lumos-mode :straight (lumos-mode :type git :host github :repo "getlumos/lumos-mode") :hook (lumos-mode . lsp-deferred))Manual Installation
Section titled “Manual Installation”# Clone the repositorygit clone https://github.com/getlumos/lumos-mode ~/.emacs.d/lumos-mode
# Add to load-path(add-to-list 'load-path "~/.emacs.d/lumos-mode")(require 'lumos-mode)Requirements
Section titled “Requirements”- Emacs 26.1+ (required)
- lsp-mode - For LSP features
- lumos-lsp - LSP server
Terminal window cargo install lumos-lsp
Features
Section titled “Features”Syntax Highlighting
Section titled “Syntax Highlighting”- Keywords:
struct,enum,type,mod,use,pub - Types: Primitives, Solana types, user-defined
- Attributes:
#[solana],#[account],#[deprecated] - Comments: Line (
//) and block (/* */)
Smart Indentation
Section titled “Smart Indentation”Automatic indentation with configurable offset (default: 4 spaces).
LSP Integration
Section titled “LSP Integration”Via lsp-mode:
- Real-time diagnostics
- Auto-completion
- Hover documentation
- Go to definition
- Find references
Configuration
Section titled “Configuration”Basic Setup
Section titled “Basic Setup”(use-package lumos-mode :ensure t :mode "\\.lumos\\'" :hook (lumos-mode . lsp-deferred) :custom (lumos-indent-offset 4))Custom LSP Server Path
Section titled “Custom LSP Server Path”(use-package lsp-mode :config (add-to-list 'lsp-language-id-configuration '(lumos-mode . "lumos"))
(lsp-register-client (make-lsp-client :new-connection (lsp-stdio-connection "lumos-lsp") :activation-fn (lsp-activate-on "lumos") :server-id 'lumos-lsp)))Keybindings
Section titled “Keybindings”Default keybindings (with lsp-mode):
| Key | Action |
|---|---|
M-. | Go to definition |
M-, | Go back |
M-? | Find references |
C-c C-r | Rename symbol |
C-c C-a | Code action |
Customization
Section titled “Customization”Variables
Section titled “Variables”;; Indentation offset(setq lumos-indent-offset 2)
;; LSP server command(setq lumos-lsp-server-command "lumos-lsp")Troubleshooting
Section titled “Troubleshooting”LSP not connecting
Section titled “LSP not connecting”-
Verify
lumos-lspis installed:Terminal window lumos-lsp --version -
Check LSP logs:
M-x lsp-workspace-show-log
Mode not activating
Section titled “Mode not activating”Ensure file association:
(add-to-list 'auto-mode-alist '("\\.lumos\\'" . lumos-mode))