Syntax Highlighting (VS Code)
Luma has an official Visual Studio Code extension that provides syntax highlighting, code snippets, and editor support for .luma and .lcore files.
Features
| Feature | Status |
|---|---|
| Syntax highlighting | Available |
| Code snippets | Available (11 templates) |
| Bracket matching | Available |
| Auto-closing pairs | Available |
| Comment toggling | Available |
| Code folding | Available |
| Language Server (autocomplete, hover) | Planned |
| Debugging | Planned |
| Formatter | Planned |
Installation
From VSIX file
- Download the latest
.vsixfile from the Luma repository - Open VS Code
- Open the Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Type “Install from VSIX” and select the command
- Choose the downloaded
.vsixfile
From source (development)
cd luma-vscode-extension
npm install
npm run compileThen press F5 in VS Code to launch the extension in a development host window.
What gets highlighted
The extension provides full TextMate grammar highlighting for all Luma syntax:
Keywords
- Control flow:
fn,if,else,return,walk - Declarations:
struct,trait,impl,type,import,pub,lock
Built-in functions
- Output:
print,sprint - I/O:
file,cli,glob - Type conversion:
to_int,to_str,to_float,to_bool - Web:
get,post,put,delete,text,html,json
Types
- Primitives:
int,float,bool,str,byte - Special:
datetime,date,time,void,any,file,cli - Optional:
?int,?str, etc. - Server:
Request,Response,Route,ServerConfig
Literals and operators
- Strings with
${}interpolation highlighting - Escape sequences:
\n,\r,\t,\\,\",\$ - Numbers (decimal and hexadecimal
0x...) - All operators: arithmetic, comparison, logical, range (
..,..=), arrow (->,=>) - Comments (single-line
//and block/* */)
Code snippets
The extension includes snippets for common patterns. Type the prefix and press Tab:
| Prefix | Expands to |
|---|---|
fn |
Function definition |
var |
Variable declaration |
if |
If/else block |
walk |
Walk loop |
struct |
Struct definition |
impl |
Implementation block |
trait |
Trait declaration |
import |
Import statement |
lock |
Immutable variable |
server |
Web server setup |
route |
Route definition |
handler |
HTTP handler function |
File associations
The extension automatically activates for:
.lumafiles (Luma source code).lcorefiles (Luma core runtime functions)
Editor features
The language configuration enables:
- Line comments with
// - Block comments with
/* ... */ - Auto-closing of brackets
{},[],()and quotes"",'' - Auto-indentation after opening braces
- Bracket pair highlighting
- Code folding for block comments and brace-delimited blocks
Last updated on