Skip to content

Commit aea9940

Browse files
authored
feat(zig): snippets (rafamadriz#491)
* feat: zig json init * chore: rebased package.json * feat: buildexe snip
1 parent 9a91957 commit aea9940

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -584,10 +584,14 @@
584584
"language": "loremipsum",
585585
"path": "./snippets/loremipsum.json"
586586
},
587-
{
588-
"language": "cmake",
589-
"path": "./snippets/cmake.json"
590-
}
587+
{
588+
"language": "cmake",
589+
"path": "./snippets/cmake.json"
590+
},
591+
{
592+
"language": "zig",
593+
"path": "./snippets/zig.json"
594+
}
591595
]
592596
}
593597
}

snippets/zig.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"Import": {
3+
"prefix": "import",
4+
"body": ["const ${1} = @import(\"${1}\")"],
5+
"description": "Importing Librarys"
6+
},
7+
"CImport": {
8+
"prefix": "cimport",
9+
"body": [
10+
"const c = @cImport({",
11+
"@cDefine(\"${1}\")",
12+
"});"
13+
],
14+
"description": "Importing C Header Files"
15+
},
16+
"buildExe": {
17+
"prefix": "bExe",
18+
"body": [
19+
"const exe = b.addExecutable(.{",
20+
".name = \"${1}",\",
21+
".root_source_file = b.path(\"${2: path}\"),",
22+
".target = target,",
23+
".optimize = optimize,",
24+
"});",
25+
"\n\n\n b.installArtifact(exe);",
26+
],
27+
"description": "Building an exe"
28+
}
29+
}

0 commit comments

Comments
 (0)