Skip to content

Commit 7e990ff

Browse files
Add new context option to add ability to run as zig run (#19)
added a ability to run a single zig file using 'zig run' command along side of zig build. <img width="524" height="447" alt="screenshot-2025-12-19_22-32-35" src="https://github.com/user-attachments/assets/e79e1880-fbca-4579-97e6-061b20790d53" /> <img width="580" height="497" alt="screenshot-2025-12-19_22-33-23" src="https://github.com/user-attachments/assets/407f23de-5ef0-46a3-99da-ff5e6861ea56" /> Co-authored-by: Finn Evers <[email protected]>
1 parent 64c847f commit 7e990ff

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

languages/zig/runnables.scm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
((function_declaration
99
name: (identifier) @_name) @run
1010
(#match? @_name "main")
11-
(#set! tag zig-build-run))
11+
(#set! tag zig-build-run)
12+
(#set! tag zig-run))

languages/zig/tasks.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
"args": ["build", "run"],
66
"tags": ["zig-build-run"]
77
},
8+
{
9+
"label": "zig run",
10+
"command": "zig",
11+
"args": ["run", "$ZED_FILE"],
12+
"tags": ["zig-run"]
13+
},
814
{
915
"label": "zig build test",
1016
"command": "zig",

src/zig.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,13 @@ impl zed::Extension for ZigExtension {
214214
cwd,
215215
}
216216
}
217+
Some(arg) if arg == "run" => zed::BuildTaskTemplate {
218+
label: "zig run".into(),
219+
command: "zig".into(),
220+
args: vec!["run".into()],
221+
env,
222+
cwd,
223+
},
217224
_ => return None,
218225
};
219226

0 commit comments

Comments
 (0)