Skip to content

Commit 8489479

Browse files
committed
fix superhtml cli tool
the update to zig 0.14.0 fixed using superhtml as a library, but failed to update the CLI tool code, mainly because the test step would only run unit tests without trying to build the full library. this commit fixes the few issues that remained and also made the `test` step depend on `check`, ensuring that going forward the CLI tool doesn't lag behind
1 parent 15ff939 commit 8489479

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

build.zig

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ pub fn build(b: *std.Build) !void {
5151
const folders = b.dependency("known_folders", .{});
5252
const lsp = b.dependency("lsp_kit", .{});
5353

54-
setupTestStep(b, target, superhtml);
54+
const check = setupCheckStep(b, target, optimize, options, superhtml, folders, lsp);
55+
setupTestStep(b, target, superhtml, check);
5556
setupCliTool(b, target, optimize, options, superhtml, folders, lsp);
5657
setupWasmStep(b, optimize, options, superhtml, lsp);
57-
setupCheckStep(b, target, optimize, options, superhtml, folders, lsp);
5858
if (version == .tag) {
5959
setupReleaseStep(b, options, superhtml, folders, lsp);
6060
}
@@ -76,7 +76,8 @@ fn setupCheckStep(
7676
superhtml: *std.Build.Module,
7777
folders: *std.Build.Dependency,
7878
lsp: *std.Build.Dependency,
79-
) void {
79+
) *std.Build.Step {
80+
const check = b.step("check", "Check if the SuperHTML CLI compiles");
8081
const super_cli_check = b.addExecutable(.{
8182
.name = "superhtml",
8283
.root_source_file = b.path("src/cli.zig"),
@@ -92,15 +93,17 @@ fn setupCheckStep(
9293
super_cli_check.root_module.addImport("lsp", lsp.module("lsp"));
9394
super_cli_check.root_module.addOptions("build_options", options);
9495

95-
const check = b.step("check", "Check if the SuperHTML CLI compiles");
9696
check.dependOn(&super_cli_check.step);
97+
return check;
9798
}
9899
fn setupTestStep(
99100
b: *std.Build,
100101
target: std.Build.ResolvedTarget,
101102
superhtml: *std.Build.Module,
103+
check: *std.Build.Step,
102104
) void {
103105
const test_step = b.step("test", "Run unit tests");
106+
test_step.dependOn(check);
104107

105108
const unit_tests = b.addTest(.{
106109
.root_source_file = b.path("src/root.zig"),
@@ -273,7 +276,7 @@ fn setupReleaseStep(
273276
super_exe_release.root_module.addImport("superhtml", superhtml);
274277
super_exe_release.root_module.addImport(
275278
"known_folders",
276-
folders.module("known_folders"),
279+
folders.module("known-folders"),
277280
);
278281
super_exe_release.root_module.addImport("lsp", lsp.module("lsp"));
279282
super_exe_release.root_module.addOptions("build_options", options);

src/cli.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const std = @import("std");
22
const builtin = @import("builtin");
33
const build_options = @import("build_options");
4-
const known = @import("known-folders");
4+
const known = @import("known_folders");
55
const super = @import("super");
66
const logging = @import("cli/logging.zig");
77
const interface_exe = @import("cli/interface.zig");

src/cli/logging.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const std = @import("std");
22
const builtin = @import("builtin");
33
const build_options = @import("build_options");
4-
const folders = @import("known-folders");
4+
const folders = @import("known_folders");
55

66
pub var log_file: ?std.fs.File = switch (builtin.target.os.tag) {
77
.linux, .macos => std.io.getStdErr(),

src/cli/lsp.zig

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,14 @@ pub const Handler = struct {
284284
};
285285
}
286286

287+
pub fn documentSymbol(
288+
_: Handler,
289+
_: std.mem.Allocator,
290+
_: types.DocumentSymbolParams,
291+
) !ResultType("textDocument/documentSymbol") {
292+
return null;
293+
}
294+
287295
pub fn references(
288296
_: Handler,
289297
arena: std.mem.Allocator,
@@ -353,7 +361,7 @@ pub const Handler = struct {
353361
_ = self;
354362
const id: []const u8 = switch (_response.id) {
355363
.string => |id| id,
356-
.integer => |id| {
364+
.number => |id| {
357365
log.warn("received response from client with id '{d}' that has no handler!", .{id});
358366
return;
359367
},

0 commit comments

Comments
 (0)