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>
This commit is contained in:
182
editors/vscode/snippets/lux.json
Normal file
182
editors/vscode/snippets/lux.json
Normal file
@@ -0,0 +1,182 @@
|
||||
{
|
||||
"Function": {
|
||||
"prefix": "fn",
|
||||
"body": [
|
||||
"fn ${1:name}(${2:params}): ${3:ReturnType} =",
|
||||
" ${0:body}"
|
||||
],
|
||||
"description": "Define a function"
|
||||
},
|
||||
"Function with Effects": {
|
||||
"prefix": "fne",
|
||||
"body": [
|
||||
"fn ${1:name}(${2:params}): ${3:ReturnType} with {${4:Effects}} = {",
|
||||
" ${0:body}",
|
||||
"}"
|
||||
],
|
||||
"description": "Define a function with effects"
|
||||
},
|
||||
"Type Definition": {
|
||||
"prefix": "type",
|
||||
"body": [
|
||||
"type ${1:Name} =",
|
||||
" | ${2:Variant}(${3:fields})"
|
||||
],
|
||||
"description": "Define an algebraic data type"
|
||||
},
|
||||
"Effect Definition": {
|
||||
"prefix": "effect",
|
||||
"body": [
|
||||
"effect ${1:Name} {",
|
||||
" fn ${2:operation}(${3:params}): ${4:ReturnType}",
|
||||
"}"
|
||||
],
|
||||
"description": "Define an effect"
|
||||
},
|
||||
"Handler": {
|
||||
"prefix": "handler",
|
||||
"body": [
|
||||
"handler ${1:name}: ${2:Effect} {",
|
||||
" fn ${3:operation}(${4:params}) = {",
|
||||
" ${5:body}",
|
||||
" resume(${0:value})",
|
||||
" }",
|
||||
"}"
|
||||
],
|
||||
"description": "Define an effect handler"
|
||||
},
|
||||
"Match Expression": {
|
||||
"prefix": "match",
|
||||
"body": [
|
||||
"match ${1:value} {",
|
||||
" ${2:Pattern} => ${3:result},",
|
||||
" ${0:_ => default}",
|
||||
"}"
|
||||
],
|
||||
"description": "Pattern matching expression"
|
||||
},
|
||||
"If Expression": {
|
||||
"prefix": "if",
|
||||
"body": [
|
||||
"if ${1:condition} then ${2:trueCase}",
|
||||
"else ${0:falseCase}"
|
||||
],
|
||||
"description": "Conditional expression"
|
||||
},
|
||||
"Let Binding": {
|
||||
"prefix": "let",
|
||||
"body": [
|
||||
"let ${1:name} = ${0:value}"
|
||||
],
|
||||
"description": "Let binding"
|
||||
},
|
||||
"Run Expression": {
|
||||
"prefix": "run",
|
||||
"body": [
|
||||
"run ${1:expr} with {",
|
||||
" ${0:handlers}",
|
||||
"}"
|
||||
],
|
||||
"description": "Run expression with handlers"
|
||||
},
|
||||
"Trait Definition": {
|
||||
"prefix": "trait",
|
||||
"body": [
|
||||
"trait ${1:Name}<${2:T}> {",
|
||||
" fn ${3:method}(${4:self}: ${2:T}): ${5:ReturnType}",
|
||||
"}"
|
||||
],
|
||||
"description": "Define a trait"
|
||||
},
|
||||
"Impl Block": {
|
||||
"prefix": "impl",
|
||||
"body": [
|
||||
"impl ${1:Trait} for ${2:Type} {",
|
||||
" fn ${3:method}(${4:self}): ${5:ReturnType} =",
|
||||
" ${0:body}",
|
||||
"}"
|
||||
],
|
||||
"description": "Implement a trait"
|
||||
},
|
||||
"Option Match": {
|
||||
"prefix": "matchopt",
|
||||
"body": [
|
||||
"match ${1:option} {",
|
||||
" Some(${2:value}) => ${3:someCase},",
|
||||
" None => ${0:noneCase}",
|
||||
"}"
|
||||
],
|
||||
"description": "Match on Option"
|
||||
},
|
||||
"Result Match": {
|
||||
"prefix": "matchres",
|
||||
"body": [
|
||||
"match ${1:result} {",
|
||||
" Ok(${2:value}) => ${3:okCase},",
|
||||
" Err(${4:error}) => ${0:errCase}",
|
||||
"}"
|
||||
],
|
||||
"description": "Match on Result"
|
||||
},
|
||||
"Console Print": {
|
||||
"prefix": "print",
|
||||
"body": [
|
||||
"Console.print(${0:\"message\"})"
|
||||
],
|
||||
"description": "Print to console"
|
||||
},
|
||||
"Main Function": {
|
||||
"prefix": "main",
|
||||
"body": [
|
||||
"fn main(): Unit with {Console} = {",
|
||||
" ${0:body}",
|
||||
"}",
|
||||
"",
|
||||
"let output = run main() with {}"
|
||||
],
|
||||
"description": "Main function template"
|
||||
},
|
||||
"Doc Comment": {
|
||||
"prefix": "///",
|
||||
"body": [
|
||||
"/// ${1:Description}",
|
||||
"///",
|
||||
"/// # Examples",
|
||||
"/// ```lux",
|
||||
"/// ${0:example}",
|
||||
"/// ```"
|
||||
],
|
||||
"description": "Documentation comment"
|
||||
},
|
||||
"Record Type": {
|
||||
"prefix": "record",
|
||||
"body": [
|
||||
"type ${1:Name} = {",
|
||||
" ${2:field}: ${3:Type},",
|
||||
" ${0:...}",
|
||||
"}"
|
||||
],
|
||||
"description": "Define a record type"
|
||||
},
|
||||
"List Map": {
|
||||
"prefix": "lmap",
|
||||
"body": [
|
||||
"List.map(${1:list}, fn(${2:x}: ${3:T}): ${4:U} => ${0:transform})"
|
||||
],
|
||||
"description": "Map over a list"
|
||||
},
|
||||
"List Filter": {
|
||||
"prefix": "lfilter",
|
||||
"body": [
|
||||
"List.filter(${1:list}, fn(${2:x}: ${3:T}): Bool => ${0:predicate})"
|
||||
],
|
||||
"description": "Filter a list"
|
||||
},
|
||||
"List Fold": {
|
||||
"prefix": "lfold",
|
||||
"body": [
|
||||
"List.fold(${1:list}, ${2:initial}, fn(${3:acc}: ${4:A}, ${5:x}: ${6:T}): ${4:A} => ${0:combine})"
|
||||
],
|
||||
"description": "Fold over a list"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user