lua snippets
Viewable at https://gist.github.com/drhayes/a8e64c1b31ec9e0bd71d3a73fc73a051.
{
"Busted describe block": {
"prefix": "desc",
"body": [
"describe('${1:thing to test}', function()",
" $0",
"end)"
]
},
"Busted it block": {
"prefix": "it",
"body": [
"it('${1:does a thing}', function()",
" $0",
"end)"
]
},
"Local require": {
"prefix": "lreq",
"body": [
"local ${1:lume} = require '${2:lib.$1}'$0"
]
},
"assert.are.equal": {
"prefix": "aae",
"body": [
"assert.are.equal(${1:first}, ${2:second})"
]
},
"method": {
"prefix": "fun:",
"body": [
"function ${1:${TM_FILENAME_BASE/(.*)$/${1:/capitalize}/}}:${2:functionName}($3)",
"\t$0",
"end"
]
},
"function": {
"prefix": "fun",
"body": [
"function ${1:$TM_FILENAME_BASE}.${2:functionName}($3)",
"\t$0",
"end"
]
},
"ldi": {
"prefix": "ldi",
"body": "log.debug(inspect($0))"
},
"super": {
"prefix": "super",
"body": "${1:${TM_FILENAME_BASE/(.*)$/${1:/capitalize}/}}.super.${2:Method}(self$0)"
},
"inc": {
"prefix": "inc",
"body": "${1:var} = $1 + ${2:1}$0"
},
"dec": {
"prefix": "dec",
"body": "${1:var} = $1 - ${2:1}$0"
},
"For pairs iterator": {
"prefix": "forp",
"body": [
"for ${1:key}, ${2:value} in pairs($3) do",
"\t$0",
"end"
]
},
"For loop over collection": {
"prefix": "for",
"body": [
"for ${1:i} = 1, #${2:collection} do",
"\tlocal ${3:child} = $2[$1]$0",
"end",
]
}
}