{ "Function Definition": { "prefix": "func", "body": [ "func ${1:functionName}(${2:parameters}) {", "\t$0", "}" ], "description": "Create a new function" }, "If Statement": { "prefix": "if", "body": [ "if (${1:condition}) {", "\t$0", "}" ], "description": "Create an if statement" }, "If-Else Statement": { "prefix": "ifelse", "body": [ "if (${1:condition}) {", "\t$2", "} else {", "\t$0", "}" ], "description": "Create an if-else statement" }, "While Loop": { "prefix": "while", "body": [ "while (${1:condition}) {", "\t$0", "}" ], "description": "Create a while loop" }, "For Loop": { "prefix": "for", "body": [ "for (${1:initialization}; ${2:condition}; ${3:increment}) {", "\t$0", "}" ], "description": "Create a for loop" }, "Variable Declaration": { "prefix": "var", "body": [ "var ${1:variableName} = ${2:value};" ], "description": "Declare a variable" }, "Print Statement": { "prefix": "print", "body": [ "print(${1:expression});" ], "description": "Print a value" }, "Assert Statement": { "prefix": "assert", "body": [ "assert(${1:condition}, \"${2:message}\");" ], "description": "Create an assertion" }, "Anonymous Function": { "prefix": "anon", "body": [ "func(${1:parameters}) {", "\t$0", "}" ], "description": "Create an anonymous function" }, "Return Statement": { "prefix": "return", "body": [ "return ${1:value};" ], "description": "Return a value from function" }, "Break Statement": { "prefix": "break", "body": [ "break;" ], "description": "Break out of loop" }, "Continue Statement": { "prefix": "continue", "body": [ "continue;" ], "description": "Continue to next iteration" }, "Comment Block": { "prefix": "comment", "body": [ "/*", " * ${1:comment}", " */" ], "description": "Create a comment block" }, "Test Function": { "prefix": "test", "body": [ "func test${1:TestName}() {", "\tvar result = ${2:testExpression};", "\tassert(result == ${3:expectedValue}, \"${4:test message}\");", "\tprint(\"${1:TestName}: PASS\");", "}" ], "description": "Create a test function" }, "Higher-Order Function": { "prefix": "hof", "body": [ "func ${1:functionName}(${2:callback}) {", "\treturn func(${3:params}) {", "\t\t$0", "\t};", "}" ], "description": "Create a higher-order function" }, "Closure": { "prefix": "closure", "body": [ "func ${1:outerFunction}(${2:param}) {", "\tvar ${3:capturedVar} = ${4:value};", "\treturn func(${5:innerParam}) {", "\t\treturn ${3:capturedVar} + ${5:innerParam};", "\t};", "}" ], "description": "Create a closure" }, "Counter Pattern": { "prefix": "counter", "body": [ "func createCounter() {", "\tvar count = 0;", "\treturn func() {", "\t\tcount = count + 1;", "\t\treturn count;", "\t};", "}" ], "description": "Create a counter function" }, "Loop with Break": { "prefix": "loopbreak", "body": [ "while (${1:condition}) {", "\tif (${2:breakCondition}) {", "\t\tbreak;", "\t}", "\t$0", "}" ], "description": "Create a loop with break condition" }, "Loop with Continue": { "prefix": "loopcontinue", "body": [ "for (${1:initialization}; ${2:condition}; ${3:increment}) {", "\tif (${4:continueCondition}) {", "\t\tcontinue;", "\t}", "\t$0", "}" ], "description": "Create a loop with continue condition" }, "Nested Loop": { "prefix": "nestedloop", "body": [ "for (var i = 0; i < ${1:outerLimit}; i = i + 1) {", "\tfor (var j = 0; j < ${2:innerLimit}; j = j + 1) {", "\t\t$0", "\t}", "}" ], "description": "Create nested loops" }, "Function with Early Return": { "prefix": "earlyreturn", "body": [ "func ${1:functionName}(${2:param}) {", "\tif (${3:condition}) {", "\t\treturn ${4:earlyValue};", "\t}", "\t$0", "\treturn ${5:defaultValue};", "}" ], "description": "Create a function with early return" }, "String Concatenation": { "prefix": "concat", "body": [ "var result = \"${1:first}\" + \"${2:second}\";" ], "description": "Concatenate strings" }, "Number Operations": { "prefix": "math", "body": [ "var result = ${1:expression};" ], "description": "Mathematical expression" }, "Boolean Logic": { "prefix": "bool", "body": [ "var result = ${1:condition} == ${2:value};" ], "description": "Boolean comparison" }, "Type Check": { "prefix": "type", "body": [ "var typeResult = type(${1:expression});" ], "description": "Check type of expression" }, "ToString": { "prefix": "tostring", "body": [ "var stringResult = toString(${1:expression});" ], "description": "Convert to string" }, "Test Suite Header": { "prefix": "testsuite", "body": [ "// ========================================", "// ${1:TEST SUITE NAME}", "// ========================================", "// ${2:Description}", "", "print(\"${1:TEST SUITE NAME}\");", "print(\"Running tests...\");", "", "$0", "", "print(\"All tests passed!\");" ], "description": "Create a test suite header" }, "Test Section": { "prefix": "testsection", "body": [ "// ========================================", "// TEST ${1:NUMBER}: ${2:TEST NAME}", "// ========================================", "print(\"\\n--- Test ${1:NUMBER}: ${2:TEST NAME} ---\");", "", "$0", "", "print(\"${2:TEST NAME}: PASS\");" ], "description": "Create a test section" }, "Debug Print": { "prefix": "debug", "body": [ "print(\"DEBUG: ${1:variable} = \" + toString(${1:variable}));" ], "description": "Debug print statement" }, "Error Message": { "prefix": "error", "body": [ "print(\"ERROR: ${1:error message}\");" ], "description": "Error message print" }, "Success Message": { "prefix": "success", "body": [ "print(\"SUCCESS: ${1:success message}\");" ], "description": "Success message print" } }