db7ba1dff2
ci / build (ubuntu) (push) Has been cancelled
ci / unit + fmt (push) Has been cancelled
ci / examples (push) Has been cancelled
ci / goldens + tools (push) Has been cancelled
ci / apps (push) Has been cancelled
ci / selfhost smoke (push) Has been cancelled
ci / macos smoke (push) Has been cancelled
ci / windows smoke (push) Has been cancelled
ci / CI gate (push) Has been cancelled
selfhost-loop / bootstrap determinism (push) Has been cancelled
bux-lsp 0.17 publishes in-process diagnostics on open/change/save so editors show red squiggles for lex/parse/type errors in the live buffer. VS Code client discovers tools/bux-lsp, adds status bar/restart, richer syntax/snippets, and docs (docs/LSP.md) for forum/editor setup.
305 lines
7.5 KiB
JSON
305 lines
7.5 KiB
JSON
{
|
|
"Main function": {
|
|
"prefix": "main",
|
|
"body": [
|
|
"func Main() -> int {",
|
|
" $1",
|
|
" return 0;",
|
|
"}"
|
|
],
|
|
"description": "Main entry point function"
|
|
},
|
|
"Hello World": {
|
|
"prefix": "hello",
|
|
"body": [
|
|
"import Std::Io::{PrintLine};",
|
|
"",
|
|
"func Main() -> int {",
|
|
" PrintLine(\"${1:Hello, Bux!}\");",
|
|
" return 0;",
|
|
"}"
|
|
],
|
|
"description": "Minimal Hello World program"
|
|
},
|
|
"Function": {
|
|
"prefix": "func",
|
|
"body": [
|
|
"func ${1:Name}(${2:params}) -> ${3:void} {",
|
|
" $0",
|
|
"}"
|
|
],
|
|
"description": "Function declaration"
|
|
},
|
|
"Async Function": {
|
|
"prefix": "afunc",
|
|
"body": [
|
|
"async func ${1:Name}(${2:params}) -> ${3:void} {",
|
|
" $0",
|
|
"}"
|
|
],
|
|
"description": "Async function declaration"
|
|
},
|
|
"Generic function": {
|
|
"prefix": "gfunc",
|
|
"body": [
|
|
"func ${1:Name}<${2:T}>(${3:param}: ${2:T}) -> ${2:T} {",
|
|
" $0",
|
|
"}"
|
|
],
|
|
"description": "Generic function"
|
|
},
|
|
"Variable (let)": {
|
|
"prefix": "let",
|
|
"body": [
|
|
"let ${1:name}: ${2:Type} = ${3:value};"
|
|
],
|
|
"description": "Immutable variable"
|
|
},
|
|
"Variable (var)": {
|
|
"prefix": "var",
|
|
"body": [
|
|
"var ${1:name}: ${2:Type} = ${3:value};"
|
|
],
|
|
"description": "Mutable variable"
|
|
},
|
|
"Const": {
|
|
"prefix": "const",
|
|
"body": [
|
|
"const ${1:NAME}: ${2:Type} = ${3:value};"
|
|
],
|
|
"description": "Constant declaration"
|
|
},
|
|
"Struct": {
|
|
"prefix": "struct",
|
|
"body": [
|
|
"struct ${1:Name} {",
|
|
" ${2:field}: ${3:Type};",
|
|
"}"
|
|
],
|
|
"description": "Struct declaration"
|
|
},
|
|
"Enum": {
|
|
"prefix": "enum",
|
|
"body": [
|
|
"enum ${1:Name} {",
|
|
" ${2:Variant1},",
|
|
" ${3:Variant2},",
|
|
"}"
|
|
],
|
|
"description": "Enum declaration"
|
|
},
|
|
"Generic enum": {
|
|
"prefix": "genum",
|
|
"body": [
|
|
"enum ${1:Name}<${2:T}> {",
|
|
" ${3:Some}(${2:T}),",
|
|
" ${4:None},",
|
|
"}"
|
|
],
|
|
"description": "Generic enum declaration"
|
|
},
|
|
"Interface": {
|
|
"prefix": "interface",
|
|
"body": [
|
|
"interface ${1:Name} {",
|
|
" func ${2:Method}(${3:self}) -> ${4:void};",
|
|
"}"
|
|
],
|
|
"description": "Interface declaration"
|
|
},
|
|
"Extend methods": {
|
|
"prefix": "extend",
|
|
"body": [
|
|
"extend ${1:Type} {",
|
|
" func ${2:Method}(self) -> ${3:void} {",
|
|
" $0",
|
|
" }",
|
|
"}"
|
|
],
|
|
"description": "Extend block for inherent methods"
|
|
},
|
|
"Extend for interface": {
|
|
"prefix": "extendfor",
|
|
"body": [
|
|
"extend ${1:Type} for ${2:Interface} {",
|
|
" func ${3:Method}(self) -> ${4:void} {",
|
|
" $0",
|
|
" }",
|
|
"}"
|
|
],
|
|
"description": "Implement interface for type"
|
|
},
|
|
"If statement": {
|
|
"prefix": "if",
|
|
"body": [
|
|
"if ${1:condition} {",
|
|
" $0",
|
|
"}"
|
|
],
|
|
"description": "If statement"
|
|
},
|
|
"If-else": {
|
|
"prefix": "ifelse",
|
|
"body": [
|
|
"if ${1:condition} {",
|
|
" ${2:body}",
|
|
"} else {",
|
|
" $0",
|
|
"}"
|
|
],
|
|
"description": "If-else statement"
|
|
},
|
|
"While loop": {
|
|
"prefix": "while",
|
|
"body": [
|
|
"while ${1:condition} {",
|
|
" $0",
|
|
"}"
|
|
],
|
|
"description": "While loop"
|
|
},
|
|
"For-in loop": {
|
|
"prefix": "for",
|
|
"body": [
|
|
"for ${1:item} in ${2:iterable} {",
|
|
" $0",
|
|
"}"
|
|
],
|
|
"description": "For-in loop"
|
|
},
|
|
"Loop": {
|
|
"prefix": "loop",
|
|
"body": [
|
|
"loop {",
|
|
" $0",
|
|
"}"
|
|
],
|
|
"description": "Infinite loop"
|
|
},
|
|
"Match": {
|
|
"prefix": "match",
|
|
"body": [
|
|
"match ${1:expr} {",
|
|
" ${2:pattern} => ${3:action},",
|
|
" _ => ${4:default},",
|
|
"}"
|
|
],
|
|
"description": "Pattern match expression"
|
|
},
|
|
"Switch": {
|
|
"prefix": "switch",
|
|
"body": [
|
|
"switch ${1:expr} {",
|
|
" case ${2:value}:",
|
|
" $0",
|
|
" break;",
|
|
" default:",
|
|
" break;",
|
|
"}"
|
|
],
|
|
"description": "Switch statement"
|
|
},
|
|
"Import": {
|
|
"prefix": "import",
|
|
"body": [
|
|
"import Std::${1:Io}::{${2:PrintLine}};"
|
|
],
|
|
"description": "Import from Std"
|
|
},
|
|
"Module": {
|
|
"prefix": "module",
|
|
"body": [
|
|
"module ${1:Name} {",
|
|
" $0",
|
|
"}"
|
|
],
|
|
"description": "Module declaration"
|
|
},
|
|
"@Checked function": {
|
|
"prefix": "checked",
|
|
"body": [
|
|
"@[Checked]",
|
|
"func ${1:Name}(${2:params}) -> ${3:void} {",
|
|
" $0",
|
|
"}"
|
|
],
|
|
"description": "Checked function with borrow checker"
|
|
},
|
|
"@Release function": {
|
|
"prefix": "release",
|
|
"body": [
|
|
"@[Release]",
|
|
"func ${1:Name}(${2:params}) -> ${3:void} {",
|
|
" $0",
|
|
"}"
|
|
],
|
|
"description": "Release (unchecked) function"
|
|
},
|
|
"Defer": {
|
|
"prefix": "defer",
|
|
"body": [
|
|
"defer ${1:cleanup};"
|
|
],
|
|
"description": "Defer cleanup"
|
|
},
|
|
"PrintLine": {
|
|
"prefix": "pl",
|
|
"body": [
|
|
"PrintLine(\"${1:message}\");"
|
|
],
|
|
"description": "Print with newline"
|
|
},
|
|
"Interpolated string": {
|
|
"prefix": "fstr",
|
|
"body": [
|
|
"f\"${1:Hello, }{${2:name}}\""
|
|
],
|
|
"description": "Interpolated f-string"
|
|
},
|
|
"Macro definition": {
|
|
"prefix": "macro",
|
|
"body": [
|
|
"macro! ${1:name} {",
|
|
" (\\$${2:x}:expr) => {",
|
|
" $0",
|
|
" }",
|
|
"}"
|
|
],
|
|
"description": "Declarative macro! definition"
|
|
},
|
|
"Test assert": {
|
|
"prefix": "tassert",
|
|
"body": [
|
|
"Test_AssertEq${1:Int}(${2:got}, ${3:want});"
|
|
],
|
|
"description": "Test equality assertion"
|
|
},
|
|
"Spawn task": {
|
|
"prefix": "spawn",
|
|
"body": [
|
|
"let ${1:handle}: *void = spawn ${2:Worker}(${3:args});"
|
|
],
|
|
"description": "Spawn green-thread task"
|
|
},
|
|
"Result Ok/Err match": {
|
|
"prefix": "resultmatch",
|
|
"body": [
|
|
"match ${1:result} {",
|
|
" Ok(${2:value}) => ${3:value},",
|
|
" Err(${4:err}) => ${5:/* handle */},",
|
|
"}"
|
|
],
|
|
"description": "Match on Result"
|
|
},
|
|
"Option Some/None match": {
|
|
"prefix": "optmatch",
|
|
"body": [
|
|
"match ${1:opt} {",
|
|
" Some(${2:value}) => ${3:value},",
|
|
" None => ${4:/* handle */},",
|
|
"}"
|
|
],
|
|
"description": "Match on Option"
|
|
}
|
|
}
|