-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzig.json
181 lines (181 loc) · 5.81 KB
/
zig.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
{
"Print Hello World": {
"prefix": ["helloworld"],
"body": [
"const std = @import(\"std\");",
"",
"pub fn main() void {",
"\tstd.debug.print(\"Hello, {s}!\\n\", .{\"World\"});",
"}"
],
"description": "Print Hello World"
},
"Import a module": {
"prefix": "import",
"body": ["const $1 = @import(\"$2\");", "$0"],
"description": "Import a module"
},
"Import standard library": {
"prefix": ["import_std", "imps"],
"body": ["const std = @import(\"std\");", "$0"],
"description": "Import standard library"
},
"Import builtin module": {
"prefix": ["import_builtin", "impb"],
"body": ["const builtin = @import(\"builtin\");", "$0"],
"description": "Import builtin module"
},
"Create a function": {
"prefix": "fn",
"body": ["fn $1($2)$3 $4 {", "\t$0", "}"],
"description": "Create a function"
},
"Create a generic function": {
"prefix": "fn_generic",
"body": ["fn $1(comptime $2: $3, $4)$5 $6 {", "\t$0", "}"],
"description": "Create a generic function"
},
"Create a public function": {
"prefix": "pub_fn",
"body": ["pub fn $1($2)$3 $4 {", "\t$0", "}"],
"description": "Create a public function"
},
"Create an inline function": {
"prefix": "inline_fn",
"body": ["inline fn $1($2)$3 $4 {", "\t$0", "}"],
"description": "Create an inline function"
},
"Create a nested function": {
"prefix": "nested_fn",
"body": ["const $1 = struct {", "\tfn $2($3)$4 $5 {", "\t\t$0", "\t}", "}.$2;"],
"description": "Create a nested function"
},
"Print debug output": {
"prefix": "debug",
"body": ["std.debug.print(\"$1\", .{ $2 });", "$0"],
"description": "Print debug output"
},
"Get standard output writer": {
"prefix": "stdout",
"body": ["const $1 = std.io.getStdOut().writer();", "$0"],
"description": "Get standard output writer"
},
"Define compile-time variable": {
"prefix": "comptime",
"body": ["comptime $1 = $2;", "$0"],
"description": "Define compile-time variable"
},
"Declare mutable variable": {
"prefix": "var",
"body": ["var $1: $2 = $3;", "$0"],
"description": "Declare mutable variable"
},
"Declare constant": {
"prefix": "const",
"body": ["const $1 = $2;", "$0"],
"description": "Declare constant"
},
"Declare typed constant": {
"prefix": "const_type",
"body": ["const $1: $2 = $3;", "$0"],
"description": "Declare typed constant"
},
"Create anonymous struct": {
"prefix": "struct",
"body": ["struct {", "\t$0", "}"],
"description": "Create anonymous struct"
},
"Create named struct": {
"prefix": "const_struct",
"body": ["const $1 = struct {", "\t$0", "};"],
"description": "Create named struct"
},
"Create enum": {
"prefix": "enum",
"body": ["const $1 = enum($2) {", "\t$0", "};"],
"description": "Create enum"
},
"Create tagged union": {
"prefix": "union",
"body": ["const $1 = union($2) {", "\t$0", "};"],
"description": "Create tagged union"
},
"Create for loop": {
"prefix": "for_value",
"body": ["for ($1) |$2| {", "\t$0", "}"],
"description": "Create for loop"
},
"Create indexed for loop": {
"prefix": "for_value_index",
"body": ["for ($1, 0..) |$2, $3| {", "\t$0", "}"],
"description": "Create indexed for loop"
},
"Create inline for loop": {
"prefix": "for_inline",
"body": ["inline for ($1) |$2| {", "\t$0", "}"],
"description": "Create inline for loop"
},
"Create labeled for loop": {
"prefix": "for_label",
"body": ["$1: for ($2) |$3| {", "\t$0", "}"],
"description": "Create labeled for loop"
},
"Create for-else loop": {
"prefix": "for_else",
"body": ["for ($1) |$2| {", "\t$3", "\tbreak true;", "} else false;", "$0"],
"description": "Create for-else loop"
},
"Create while loop": {
"prefix": "while",
"body": ["while ($1) {", "\t$0", "}"],
"description": "Create while loop"
},
"Create while-else loop": {
"prefix": "while_else",
"body": ["while ($1) {", "\t$2", "\tbreak true;", "} else false;", "$0"],
"description": "Create while-else loop"
},
"Create optional while loop": {
"prefix": "while?",
"body": ["while ($1) |$2| {", "\t$3", "} else |err| {", "\t$0", "}"],
"description": "Create optional while loop"
},
"Create nested while loop": {
"prefix": "while_label",
"body": [
"$1: while ($2) {",
"\t$3",
"\twhile ($4) {",
"\t\tbreak :$1;",
"\t\t$0",
"\t}",
"}"
],
"description": "Create nested while loop"
},
"Create list literal": {
"prefix": "list",
"body": [".{$1};", "$0"],
"description": "Create list literal"
},
"Initialize array": {
"prefix": "array_init",
"body": ["&[_$1]$2{$3};", "$0"],
"description": "Initialize array"
},
"Create array list": {
"prefix": "array_list",
"body": ["var $1 = std.ArrayList($2).init($3);", "$0"],
"description": "Create array list"
},
"Create test": {
"prefix": "test",
"body": ["test \"$1\" {", "\t$0", "}"],
"description": "Create test"
},
"Add test expectation": {
"prefix": "expect",
"body": ["try std.testing.$1($2);", "$0"],
"description": "Add test expectation"
}
}