| author | |
| committer | |
| log | ed3ca0f570e052adbed291a79e9a11bba5d3f7d0 |
| tree | 0fad76049a43ddc2936c88198b80e57b230941ef |
| parent | d70a9ea5d759fd5e61c8cd7404343c34280fe87e |
2 files changed, 11 insertions(+), 0 deletions(-)
lib/std/zig/Ast/Render.zig+1| ... | @@ -3326,6 +3326,7 @@ fn renderComments(r: *Render, start: usize, end: usize) Error!bool { | ... | @@ -3326,6 +3326,7 @@ fn renderComments(r: *Render, start: usize, end: usize) Error!bool { |
| 3326 | // Write with the canonical single space. | 3326 | // Write with the canonical single space. |
| 3327 | try ais.underlying_writer.writeAll("// zig fmt: on\n"); | 3327 | try ais.underlying_writer.writeAll("// zig fmt: on\n"); |
| 3328 | ais.disabled_offset = null; | 3328 | ais.disabled_offset = null; |
| 3329 | ais.resetLine(); | ||
| 3329 | } else if (ais.disabled_offset == null and mem.eql(u8, comment_content, "zig fmt: off")) { | 3330 | } else if (ais.disabled_offset == null and mem.eql(u8, comment_content, "zig fmt: off")) { |
| 3330 | // Write with the canonical single space. | 3331 | // Write with the canonical single space. |
| 3331 | try ais.writeAll("// zig fmt: off\n"); | 3332 | try ais.writeAll("// zig fmt: off\n"); |
lib/std/zig/parser_test.zig+10| ... | @@ -6871,6 +6871,16 @@ test "zig fmt: nested asm indentation" { | ... | @@ -6871,6 +6871,16 @@ test "zig fmt: nested asm indentation" { |
| 6871 | ); | 6871 | ); |
| 6872 | } | 6872 | } |
| 6873 | 6873 | ||
| 6874 | test "zig fmt: asm with zig fmt on" { | ||
| 6875 | try testCanonical( | ||
| 6876 | \\// zig fmt: off | ||
| 6877 | \\const A = asm("a" // zig fmt: on | ||
| 6878 | \\ : [_] "" (_), | ||
| 6879 | \\); | ||
| 6880 | \\ | ||
| 6881 | ); | ||
| 6882 | } | ||
| 6883 | |||
| 6874 | test "recovery: top level" { | 6884 | test "recovery: top level" { |
| 6875 | try testError( | 6885 | try testError( |
| 6876 | \\test "" {inline} | 6886 | \\test "" {inline} |