Skip to content

Instantly share code, notes, and snippets.

@markknol
Last active January 28, 2020 18:31
Show Gist options
  • Save markknol/7cbd46ccb91d3071be0716f6d4821d19 to your computer and use it in GitHub Desktop.
Save markknol/7cbd46ccb91d3071be0716f6d4821d19 to your computer and use it in GitHub Desktop.
vscode haxe snippets
{
/*
// Place your snippets for Haxe here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// \t, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('\t');",
"$2"
],
"description": "Log output to console"
}
*/
"Insert For Loop": {
"prefix": "for-iterable",
"body": [
"for (${1:element} in ${2:list}) {",
"\t$0",
"}"
],
"description": "Loop over iterable"
},
"Insert Range Loop": {
"prefix": "for-range",
"body": [
"for (${1:index} in ${2:start} ... ${3:end}) {",
"\t$0",
"}"
],
"description": "Iterate over range"
},
"Insert function": {
"prefix": "function",
"body": [
"${1|public ,private |}${2|inline ,static ,macro |}function ${functionName}(${arguments}):${Type} {",
"\t$0",
"}"
],
"description": "Insert class function"
},
"Insert field": {
"prefix": "var-field",
"body": [
"${1|public ,private |}${2|inline ,static |}var ${fieldName}:${Type}$0;"
],
"description": "Insert class field"
},
"Insert variable": {
"prefix": "var-local",
"body": [
"var ${fieldName}:${type} = $0;"
],
"description": "Insert local variable"
},
"Insert getter-field": {
"prefix": "getter",
"body": [
"public var ${fieldName}(get, null):${Type};",
"inline function get_${fieldName}():${Type} {",
"\t$0",
"}"
],
"description": "Insert getter property and function"
},
"Insert setter-field": {
"prefix": "setter",
"body": [
"public var ${fieldName}(null, set):${Type};",
"inline function set_${fieldName}(value:${Type}) {",
"\t$0",
"}"
],
"description": "Insert setter property and function"
},
"Insert typedef": {
"prefix": "typedef",
"body": [
"typedef ${Typedef} = $0"
],
"description": "Insert typedef"
},
"Insert class": {
"prefix": "class",
"body": [
"class ${Class} {",
"\tpublic function new() {",
"$2$0",
"\t}",
"}",
],
"description": "Insert Haxe class"
}, "Insert interface": {
"prefix": "interface",
"body": [
"interface ${Interface} {",
"\t$0",
"}",
],
"description": "Insert Haxe interface"
}, "Insert abstract": {
"prefix": "abstract",
"body": [
"abstract ${AbstractClass}(${Type}) {",
"\t$0",
"}",
],
"description": "Insert Haxe abstract"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment