From 7d61cccdb865b2028301a0597b55ac8b225af6cf Mon Sep 17 00:00:00 2001 From: Loris Cro Date: Thu, 31 Oct 2024 17:29:54 +0100 Subject: [PATCH] fix remaining rendering bug for void elements --- build.zig | 29 +++++++++++++++++++++++++++++ editors/vscode/CHANGELOG.md | 5 +++++ editors/vscode/package.json | 2 +- src/html/Ast.zig | 2 +- 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/build.zig b/build.zig index e7bc5ac..2f7a781 100644 --- a/build.zig +++ b/build.zig @@ -261,6 +261,35 @@ fn setupReleaseStep( release_step.dependOn(&target_output.step); } + + // wasm + { + const super_wasm_lsp = b.addExecutable(.{ + .name = "superhtml", + .root_source_file = b.path("src/wasm.zig"), + .target = b.resolveTargetQuery(.{ + .cpu_arch = .wasm32, + .os_tag = .wasi, + }), + .optimize = .ReleaseSmall, + .single_threaded = true, + .link_libc = false, + }); + + super_wasm_lsp.root_module.addImport("superhtml", superhtml); + super_wasm_lsp.root_module.addImport("lsp", lsp.module("lsp")); + super_wasm_lsp.root_module.addOptions("build_options", options); + + const target_output = b.addInstallArtifact(super_wasm_lsp, .{ + .dest_dir = .{ + .override = .{ + .custom = "wasm-wasi-lsponly", + }, + }, + }); + + release_step.dependOn(&target_output.step); + } } const Version = union(Kind) { diff --git a/editors/vscode/CHANGELOG.md b/editors/vscode/CHANGELOG.md index c8f5055..b46547a 100644 --- a/editors/vscode/CHANGELOG.md +++ b/editors/vscode/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to the "super" extension will be documented in this file. +## [v0.5.2] +- Starting from this release, a WASM-WASI build of SuperHTML is available on GitHub (in the Releases section) in case editors other than VSCode might watnt to bundle a wasm build of SuperHTML. + +- Fixed indentation bug when formatting void elements. + ## [v0.5.1] - This is now a web extension that can be used with vscode.dev, etc. diff --git a/editors/vscode/package.json b/editors/vscode/package.json index 9a32d7f..cbfb6fe 100644 --- a/editors/vscode/package.json +++ b/editors/vscode/package.json @@ -4,7 +4,7 @@ "description": "Language Server for HTML and SuperHTML Templates.", "repository": "https://github.com/kristoff-it/superhtml/", "publisher": "LorisCro", - "version": "0.5.1", + "version": "0.5.2", "engines": { "vscode": "^1.92.0" }, diff --git a/src/html/Ast.zig b/src/html/Ast.zig index b9fb756..6972d61 100644 --- a/src/html/Ast.zig +++ b/src/html/Ast.zig @@ -770,7 +770,7 @@ pub fn render(ast: Ast, src: []const u8, w: anytype) !void { } if (vertical) { try w.print("\n", .{}); - for (0..indentation -| 1) |_| { + for (0..indentation + extra -| 1) |_| { try w.print(" ", .{}); } }