Files
lux/editors/tree-sitter-lux/queries/highlights.scm
Brandon Lucas f786d18182 feat: add devtools (tree-sitter, neovim, formatter, CLI commands)
- Add tree-sitter grammar for syntax highlighting
- Add Neovim plugin with syntax, LSP integration, and commands
- Add code formatter (lux fmt) with check mode
- Add CLI commands: fmt, check, test, watch, init
- Add project initialization with lux.toml template

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

142 lines
2.7 KiB
Scheme

; Syntax highlighting queries for Lux
; Comments
(line_comment) @comment
(doc_comment) @comment.documentation
; Keywords
[
"fn"
"let"
"type"
"effect"
"handler"
"trait"
"impl"
"for"
"import"
"export"
"match"
"if"
"then"
"else"
"with"
"run"
"resume"
"is"
] @keyword
; Operators
[
"+"
"-"
"*"
"/"
"%"
"=="
"!="
"<"
">"
"<="
">="
"&&"
"||"
"!"
"="
"=>"
"|>"
":"
"|"
"."
","
] @operator
; Punctuation
[
"("
")"
"{"
"}"
"["
"]"
"<"
">"
] @punctuation.bracket
; Literals
(integer) @number
(float) @number.float
(string) @string
(char) @character
(boolean) @boolean
(unit) @constant.builtin
; String interpolation
(interpolation
"{" @punctuation.special
"}" @punctuation.special)
(escape_sequence) @string.escape
; Types
(type_expression (identifier) @type)
(generic_type (identifier) @type)
(type_declaration name: (identifier) @type.definition)
(type_parameters (identifier) @type.parameter)
; Built-in types
((identifier) @type.builtin
(#match? @type.builtin "^(Int|Float|Bool|String|Char|Unit|Option|Result|List)$"))
; Functions
(function_declaration name: (identifier) @function.definition)
(call_expression function: (identifier) @function.call)
(call_expression function: (member_expression member: (identifier) @function.method))
; Effect operations
(effect_declaration name: (identifier) @type.definition)
(effect_operation name: (identifier) @function.definition)
(handler_declaration name: (identifier) @function.definition)
(handler_declaration effect: (identifier) @type)
(handler_operation name: (identifier) @function.definition)
; Traits
(trait_declaration name: (identifier) @type.definition)
(trait_method name: (identifier) @function.definition)
(impl_declaration trait: (identifier) @type)
; Parameters
(parameter name: (identifier) @variable.parameter)
; Variables
(let_declaration name: (identifier) @variable.definition)
(identifier) @variable
; Patterns
(pattern (identifier) @variable)
(constructor_pattern name: (identifier) @constructor)
(field_pattern name: (identifier) @property)
; Record fields
(field_assignment name: (identifier) @property)
(record_field name: (identifier) @property)
; Member access
(member_expression member: (identifier) @property)
; Modules (capitalized identifiers used as module access)
(member_expression
object: (identifier) @module
(#match? @module "^[A-Z]"))
; Variants/Constructors (capitalized identifiers)
((identifier) @constructor
(#match? @constructor "^[A-Z][a-zA-Z0-9]*$"))
; Special identifiers
((identifier) @constant.builtin
(#match? @constant.builtin "^(None|Some|Ok|Err|true|false)$"))
; Property annotations
(property_clause (identifier) @attribute)