mirror of
https://github.com/Reuh/language-candran.git
synced 2025-12-16 01:09:07 +00:00
Added new snippets
Added a lot of snippets for loop creation and table functions
This commit is contained in:
parent
7ab944ca21
commit
73ce200ecc
2 changed files with 86 additions and 11 deletions
|
|
@ -1,13 +1,13 @@
|
||||||
{
|
{
|
||||||
"name": "language-lua",
|
"name": "language-lua",
|
||||||
"version": "0.2.0",
|
"version": "0.3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"author": "FireZenk <firezenk@gmail.com>",
|
"author": "FireZenk <firezenk@gmail.com>",
|
||||||
"description": "Add syntax highlighting and snippets to Lua files in Atom",
|
"description": "Add syntax highlighting and snippets to Lua files in Atom",
|
||||||
"repository": "https://github.com/FireZenk/language-lua",
|
"repository": "https://github.com/FireZenk/language-lua",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"atom": ">0.50.0"
|
"atom": ">=0.50.0"
|
||||||
},
|
},
|
||||||
"dependencies": {}
|
"dependencies": {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,97 @@
|
||||||
'.source.lua':
|
'.source.lua':
|
||||||
|
'multiline comment':
|
||||||
|
'prefix': '-['
|
||||||
|
'body': '--[[ ${0:comment...}]'
|
||||||
|
'nested multiline comment':
|
||||||
|
'prefix': '=['
|
||||||
|
'body': '--[=[ ${0:comment...}]='
|
||||||
|
'function':
|
||||||
|
'prefix': 'fun'
|
||||||
|
'body': 'function ${1:FunctionName} (${2:args})\n\t${0:-- body...}\nend'
|
||||||
|
'anon function':
|
||||||
|
'prefix': 'afun'
|
||||||
|
'body': '${1:FunctionName} = function (${2:args})\n\t${0:-- body...}\nend'
|
||||||
|
'while loop':
|
||||||
|
'prefix': 'while'
|
||||||
|
'body': 'while ${1:condition} do\n\t${0:-- body...}\nend'
|
||||||
|
'while loop shortcut':
|
||||||
|
'prefix': 'whi'
|
||||||
|
'body': 'while ${1:condition} do\n\t${0:-- body...}\nend'
|
||||||
|
'repeat loop':
|
||||||
|
'prefix': 'repeat'
|
||||||
|
'body': 'repeat\n\t${0:-- body...}\nuntil ${1:condition}'
|
||||||
|
'repeat loop shortcut':
|
||||||
|
'prefix': 'rep'
|
||||||
|
'body': 'repeat\n\t${0:-- body...}\nuntil ${1:condition}'
|
||||||
'for i,v in ipairs()':
|
'for i,v in ipairs()':
|
||||||
'prefix': 'fori'
|
'prefix': 'fori'
|
||||||
'body': 'for ${1:i},${2:v} in ipairs(${3:table_name}) do\n\t${0:print(i,v)}\nend'
|
'body': 'for ${1:i},${2:v} in ipairs(${3:table_name}) do\n\t${0:-- body...}\nend'
|
||||||
'for i=1,10':
|
'for i=1,10':
|
||||||
'prefix': 'for'
|
'prefix': 'for'
|
||||||
'body': 'for ${1:i}=${2:1},${3:10} do\n\t${0:print(i)}\nend'
|
'body': 'for ${1:i}=${2:1},${3:10} do\n\t${0:-- body...}\nend'
|
||||||
'for k,v in pairs()':
|
'for k,v in pairs()':
|
||||||
'prefix': 'forp'
|
'prefix': 'forp'
|
||||||
'body': 'for ${1:k},${2:v} in pairs(${3:table_name}) do\n\t${0:print(k,v)}\nend'
|
'body': 'for ${1:k},${2:v} in pairs(${3:table_name}) do\n\t${0:-- body...}\nend'
|
||||||
'function':
|
'local variable definition':
|
||||||
'prefix': 'function'
|
|
||||||
'body': 'function ${1:function_name}( ${2:...} )\n\t${0:-- body}\nend'
|
|
||||||
'local x = 1':
|
|
||||||
'prefix': 'local'
|
'prefix': 'local'
|
||||||
'body': 'local ${1:x} = ${0:1}'
|
'body': 'local ${1:x} = ${0:1}'
|
||||||
|
'local variable definition shortcut':
|
||||||
|
'prefix': 'loc'
|
||||||
|
'body': 'local ${1:x} = ${0:1}'
|
||||||
|
'local table definition':
|
||||||
|
'prefix': 'ltab'
|
||||||
|
'body': 'local ${0:name} = {}'
|
||||||
|
'return definition':
|
||||||
|
'prefix': 'return'
|
||||||
|
'body': 'return ${0:value}'
|
||||||
|
'return definition shortcut':
|
||||||
|
'prefix': 'ret'
|
||||||
|
'body': 'return ${0:value}'
|
||||||
|
'log':
|
||||||
|
'prefix': 'log'
|
||||||
|
'body': 'print("${0:logging}")'
|
||||||
|
'require':
|
||||||
|
'prefix': 'require'
|
||||||
|
'body': 'local ${0:name} = require "${1:module}"'
|
||||||
|
'require shortcut':
|
||||||
|
'prefix': 'req'
|
||||||
|
'body': 'local ${0:name} = require "${1:module}"'
|
||||||
|
'if conditional':
|
||||||
|
'prefix': 'if',
|
||||||
|
'body': 'if ${1:value} then\n\t${0:--body...}\nend'
|
||||||
|
'if else conditional':
|
||||||
|
'prefix': 'ife',
|
||||||
|
'body': 'if ${1:value} then\n\t${0:--body...}\nelse\n\t${1:--body...}\nend'
|
||||||
|
'if not conditional':
|
||||||
|
'prefix': 'ifn',
|
||||||
|
'body': 'if not ${1:value} then\n\t${0:--body...}\nend'
|
||||||
|
'if not else conditional':
|
||||||
|
'prefix': 'ifne',
|
||||||
|
'body': 'if not ${1:value} then\n\t${0:--body...}\nelse\n\t${1:--body...}\nend'
|
||||||
|
'table definition':
|
||||||
|
'prefix': 'tab'
|
||||||
|
'body': '${0:name} = {}'
|
||||||
|
'table.insert':
|
||||||
|
'prefix': 'table.insert',
|
||||||
|
'body': 'table.insert(${0:dest},${1:data})'
|
||||||
|
'table.insert shorcut':
|
||||||
|
'prefix': 'tabi',
|
||||||
|
'body': 'table.insert(${0:dest},${1:data})'
|
||||||
|
'table.foreach':
|
||||||
|
'prefix': 'table.foreach',
|
||||||
|
'body': 'table.foreach(${0:table},${1:function})'
|
||||||
|
'table.foreach shortcut':
|
||||||
|
'prefix': 'tabf',
|
||||||
|
'body': 'table.foreach(${0:table},${1:function})'
|
||||||
'table.concat':
|
'table.concat':
|
||||||
'prefix': 'table.concat'
|
'prefix': 'table.concat'
|
||||||
'body': 'table.concat( ${1:tablename}${2:, ", "}${3:, start_index}${4:, end_index} )'
|
'body': 'table.concat(${1:tablename}${2:, ", "}${3:, start_index}${4:, end_index})'
|
||||||
|
'table.concat shortcut':
|
||||||
|
'prefix': 'tabc'
|
||||||
|
'body': 'table.concat(${1:tablename}${2:, ", "}${3:, start_index}${4:, end_index})'
|
||||||
'table.sort':
|
'table.sort':
|
||||||
'prefix': 'table.sort'
|
'prefix': 'table.sort'
|
||||||
'body': 'table.sort( ${1:tablename}${2:, sortfunction} )'
|
'body': 'table.sort(${1:tablename}${2:, sortfunction})'
|
||||||
|
'table.sort shortcut':
|
||||||
|
'prefix': 'tabs',
|
||||||
|
'body': 'table.sort(${1:tablename}${2:, sortfunction})'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue