Files
lux/editors/vscode/syntaxes/lux.tmLanguage.json
Brandon Lucas a6eb349d59 feat: improve editor tooling and fix warnings
Neovim improvements:
- Add tree-sitter text objects for functions, types, blocks
- Add folding support
- Enhanced REPL integration (toggle, send line/selection)
- New commands: LuxCheck, LuxReplToggle, LuxSend
- Better keybindings with localleader

VS Code extension:
- Full syntax highlighting with TextMate grammar
- LSP client integration
- 20+ snippets for common patterns
- Commands: run, format, check, REPL
- Keybindings and context menu

Fixes:
- Fix all cargo warnings with #[allow(dead_code)] annotations
- Clean up unused variables

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 18:23:55 -05:00

204 lines
5.0 KiB
JSON

{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Lux",
"scopeName": "source.lux",
"patterns": [
{ "include": "#comments" },
{ "include": "#strings" },
{ "include": "#numbers" },
{ "include": "#keywords" },
{ "include": "#operators" },
{ "include": "#types" },
{ "include": "#functions" },
{ "include": "#variables" }
],
"repository": {
"comments": {
"patterns": [
{
"name": "comment.line.documentation.lux",
"match": "///.*$"
},
{
"name": "comment.line.double-slash.lux",
"match": "//.*$"
},
{
"name": "comment.block.lux",
"begin": "/\\*",
"end": "\\*/"
}
]
},
"strings": {
"patterns": [
{
"name": "string.quoted.double.lux",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.lux",
"match": "\\\\[nrt\\\\\"'0{}]"
},
{
"name": "meta.embedded.interpolation.lux",
"begin": "\\{",
"end": "\\}",
"beginCaptures": {
"0": { "name": "punctuation.section.interpolation.begin.lux" }
},
"endCaptures": {
"0": { "name": "punctuation.section.interpolation.end.lux" }
},
"patterns": [
{ "include": "$self" }
]
}
]
},
{
"name": "string.quoted.single.lux",
"match": "'[^'\\\\]'"
},
{
"name": "string.quoted.single.lux",
"match": "'\\\\[nrt\\\\\"'0]'"
}
]
},
"numbers": {
"patterns": [
{
"name": "constant.numeric.float.lux",
"match": "\\b\\d+\\.\\d+\\b"
},
{
"name": "constant.numeric.hex.lux",
"match": "\\b0x[0-9a-fA-F]+\\b"
},
{
"name": "constant.numeric.binary.lux",
"match": "\\b0b[01]+\\b"
},
{
"name": "constant.numeric.integer.lux",
"match": "\\b\\d+\\b"
}
]
},
"keywords": {
"patterns": [
{
"name": "keyword.control.lux",
"match": "\\b(if|then|else|match|with|run|resume)\\b"
},
{
"name": "keyword.declaration.lux",
"match": "\\b(fn|let|type|effect|handler|trait|impl|for)\\b"
},
{
"name": "keyword.other.lux",
"match": "\\b(import|export|is)\\b"
},
{
"name": "constant.language.boolean.lux",
"match": "\\b(true|false)\\b"
},
{
"name": "constant.language.unit.lux",
"match": "\\(\\)"
},
{
"name": "constant.language.option.lux",
"match": "\\b(None|Some)\\b"
},
{
"name": "constant.language.result.lux",
"match": "\\b(Ok|Err)\\b"
}
]
},
"operators": {
"patterns": [
{
"name": "keyword.operator.arrow.lux",
"match": "=>|->|<-"
},
{
"name": "keyword.operator.pipe.lux",
"match": "\\|>"
},
{
"name": "keyword.operator.comparison.lux",
"match": "==|!=|<=|>=|<|>"
},
{
"name": "keyword.operator.logical.lux",
"match": "&&|\\|\\||!"
},
{
"name": "keyword.operator.arithmetic.lux",
"match": "[+\\-*/%]"
},
{
"name": "keyword.operator.assignment.lux",
"match": "="
},
{
"name": "keyword.operator.type.lux",
"match": ":"
},
{
"name": "punctuation.separator.variant.lux",
"match": "\\|"
}
]
},
"types": {
"patterns": [
{
"name": "support.type.primitive.lux",
"match": "\\b(Int|Float|Bool|String|Char|Unit)\\b"
},
{
"name": "support.type.builtin.lux",
"match": "\\b(Option|Result|List)\\b"
},
{
"name": "entity.name.type.lux",
"match": "\\b[A-Z][a-zA-Z0-9_]*\\b"
}
]
},
"functions": {
"patterns": [
{
"name": "entity.name.function.definition.lux",
"match": "(?<=fn\\s+)[a-z_][a-zA-Z0-9_]*"
},
{
"name": "entity.name.function.call.lux",
"match": "\\b[a-z_][a-zA-Z0-9_]*(?=\\s*\\()"
},
{
"name": "entity.name.function.method.lux",
"match": "(?<=\\.)[a-z_][a-zA-Z0-9_]*(?=\\s*\\()"
}
]
},
"variables": {
"patterns": [
{
"name": "variable.parameter.lux",
"match": "(?<=[(:,]\\s*)[a-z_][a-zA-Z0-9_]*(?=\\s*:)"
},
{
"name": "variable.other.lux",
"match": "\\b[a-z_][a-zA-Z0-9_]*\\b"
}
]
}
}
}