Skip to content

Commit 50ca0cb

Browse files
committed
snippets
1 parent 1483285 commit 50ca0cb

File tree

2 files changed

+75
-1
lines changed

2 files changed

+75
-1
lines changed

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "emmylua",
33
"displayName": "EmmyLua",
44
"description": "EmmyLua plugin for vscode",
5-
"version": "0.0.3",
5+
"version": "0.0.4-preview",
66
"publisher": "tangzx",
77
"engines": {
88
"vscode": "^1.21.0"
@@ -30,6 +30,12 @@
3030
"title": "EmmyLua: Restart Lua Server"
3131
}
3232
],
33+
"snippets": [
34+
{
35+
"language": "lua",
36+
"path": "./snippets/snippets.json"
37+
}
38+
],
3339
"languages": [
3440
{
3541
"id": "lua",

snippets/snippets.json

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"local": {
3+
"prefix": "local",
4+
"body": "local ${1:var} = ${0:nil}",
5+
"description": "local variable = ...",
6+
"scope": "source.lua"
7+
},
8+
"if": {
9+
"prefix": "if",
10+
"body": "if ${1:condition} then\n\t${0:-- body}\nend",
11+
"description": "if",
12+
"scope": "source.lua"
13+
},
14+
"else if": {
15+
"prefix": "else if",
16+
"body": "else if ${1:condition} then\n\t${0:-- body}",
17+
"description": "else if",
18+
"scope": "source.lua"
19+
},
20+
"for": {
21+
"prefix": "for",
22+
"body": "for ${1:i} = ${2:1}, ${3:10} do\n\t${0:-- body}\nend",
23+
"description": "for i = 1, n do end",
24+
"scope": "source.lua"
25+
},
26+
"fori": {
27+
"prefix": "fori",
28+
"body": "for ${1:index}, ${2:value} in ipairs(${3:myTable}) do\n\t${0:-- body}\nend",
29+
"description": "for i, v in ipairs(table) do end",
30+
"scope": "source.lua"
31+
},
32+
"forp": {
33+
"prefix": "forp",
34+
"body": "for ${1:key}, ${2:value} in pairs(${3:myTable}) do\n\t${0:-- body}\nend",
35+
"description": "for k, v in pairs(table) do end",
36+
"scope": "source.lua"
37+
},
38+
"do": {
39+
"prefix": "do",
40+
"body": "do\n\t${0:-- body}\nend",
41+
"description": "do",
42+
"scope": "source.lua"
43+
},
44+
"while": {
45+
"prefix": "while",
46+
"body": "while ${1:condition} do\n\t${0:-- body}\nend",
47+
"description": "while",
48+
"scope": "source.lua"
49+
},
50+
"repeat": {
51+
"prefix": "repeat",
52+
"body": "repeat\n\t${0:-- body}\nuntil ${1:condition}",
53+
"description": "repeat",
54+
"scope": "source.lua"
55+
},
56+
"local function": {
57+
"prefix": "local function",
58+
"body": "local function ${1:func}(${2:})\n\t${0:-- body}\nend",
59+
"description": "local function",
60+
"scope": "source.lua"
61+
},
62+
"function": {
63+
"prefix": "function",
64+
"body": "function ${1:func}(${2:})\n\t${0:-- body}\nend",
65+
"description": "function",
66+
"scope": "source.lua"
67+
}
68+
}

0 commit comments

Comments
 (0)