Skip to content

Commit

Permalink
fix small regression in autoformatting code
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoff-it committed Jul 15, 2024
1 parent 52527a6 commit 9c0bb83
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions editors/vscode/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# SuperHTML LSP VSCode Extension

This extension gives you reasonable diagnostics and autoformatting on HTML files.
This extension gives you diagnostics and autoformatting for HTML files.

![](../../.github/vscode-autoformat.gif)

**NOTE: you will need to get the `super` CLI tool and have it available in your PATH (or set the path manually in your VSCode settings)!**
**NOTE: you will need to get the `superhtml` CLI tool and have it available in your PATH (or set the path manually in your VSCode settings)!**

For prebuilt binaries and more info: https://github.com/kristoff-it/super-html
For prebuilt binaries and more info: https://github.com/kristoff-it/superhtml


## Diagnostics
Expand Down
4 changes: 2 additions & 2 deletions editors/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "HTML Language Server",
"repository": "https://github.com/kristoff-it/superhtml/",
"publisher": "LorisCro",
"version": "0.1.4",
"version": "0.1.5",
"engines": {
"vscode": "^1.87.0"
},
Expand Down Expand Up @@ -90,4 +90,4 @@
"watch": "npm run build-base -- --sourcemap --watch",
"lint": "eslint . --ext .ts"
}
}
}
4 changes: 2 additions & 2 deletions src/fuzz.zig
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ test "afl++ fuzz cases" {
};

for (cases) |c| {
std.debug.print("test: \n\n{s}\n\n", .{c});
// std.debug.print("test: \n\n{s}\n\n", .{c});
const ast = try super.html.Ast.init(std.testing.allocator, c, .html);
defer ast.deinit(std.testing.allocator);
ast.debug(c);
// ast.debug(c);
}
}
13 changes: 7 additions & 6 deletions src/html/Ast.zig
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,11 @@ pub fn render(ast: Ast, src: []const u8, w: anytype) !void {
try w.writeAll(" ");
}
}
switch (current.kind) {
else => {},
.element => indentation += 1,
}
}

switch (current.kind) {
else => {},
.element => indentation += 1,
}
},
.exit => {
Expand All @@ -574,10 +575,10 @@ pub fn render(ast: Ast, src: []const u8, w: anytype) !void {
current,
});

if (pre == 0) switch (current.kind) {
switch (current.kind) {
else => {},
.element => indentation -= 1,
};
}

const open_was_vertical = std.ascii.isWhitespace(src[current.open.end]);

Expand Down
2 changes: 1 addition & 1 deletion src/root.zig
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ pub const Span = struct {

test {
_ = @import("html.zig");
// _ = @import("Ast.zig");
_ = @import("Ast.zig");
// _ = @import("template.zig");
}

0 comments on commit 9c0bb83

Please sign in to comment.