-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
indentation limited to 2 spaces ? #46
Comments
I'm seeing the same thing in helix 24.7 with the language configured as: [[language]]
name = "html"
scope = "source.html"
roots = []
file-types = ["html"]
language-servers = [ "superhtml-lsp" ]
indent = { tab-width = 4, unit = " "} |
I went and read the code and yes, the two spaces is hard coded. I wrote my own patch to change it to four spaces which is what I normally use. This is really hacky and will break the tests. If I knew a bit more about lsp servers I'd maybe attempt a PR to use a workspace config to allow this configuration. diff --git a/src/html/Ast.zig b/src/html/Ast.zig
index a91b687..951c5ec 100644
--- a/src/html/Ast.zig
+++ b/src/html/Ast.zig
@@ -6,7 +6,6 @@ const Language = root.Language;
const Span = root.Span;
const Tokenizer = @import("Tokenizer.zig");
-const indent_string = " ";
const log = std.log.scoped(.@"html/ast");
const TagNameMap = std.StaticStringMapWithEql(
@@ -563,7 +562,7 @@ pub fn render(ast: Ast, src: []const u8, w: anytype) !void {
log.debug("adding a newline", .{});
try w.writeAll("\n");
for (0..indentation) |_| {
- try w.writeAll(indent_string);
+ try w.writeAll(" ");
}
}
}
@@ -599,7 +598,7 @@ pub fn render(ast: Ast, src: []const u8, w: anytype) !void {
if (open_was_vertical) {
try w.writeAll("\n");
for (0..indentation) |_| {
- try w.writeAll(indent_string);
+ try w.writeAll(" ");
}
}
}
@@ -746,7 +745,7 @@ pub fn render(ast: Ast, src: []const u8, w: anytype) !void {
if (vertical) {
try w.print("\n", .{});
for (0..indentation + extra) |_| {
- try w.print(indent_string, .{});
+ try w.print(" ", .{});
}
} else {
try w.print(" ", .{});
@@ -772,7 +771,7 @@ pub fn render(ast: Ast, src: []const u8, w: anytype) !void {
if (vertical) {
try w.print("\n", .{});
for (0..indentation + extra -| 1) |_| {
- try w.print(indent_string, .{});
+ try w.print(" ", .{});
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi and thanks for this superb tool! I'm very excited of using it during HTML workshops for beginners!
I did some tests, but I couldn't figure out how to use another indentation strategy (like using tabs, or 4 spaces)
I was wondering if it was a limitation of the project, or if I'm just missed something 🥴.
I'm on VS code:
with
The text was updated successfully, but these errors were encountered: