zig fmt: fix file ending in a multi line comment
This commit is contained in:
committed by
Veikka Tuominen
parent
d8c3c11c6c
commit
885d696895
@@ -186,6 +186,15 @@ test "zig fmt: file ends in comment" {
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: file ends in multi line comment" {
|
||||
try testTransform(
|
||||
\\ \\foobar
|
||||
,
|
||||
\\\\foobar
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: file ends in comment after var decl" {
|
||||
try testTransform(
|
||||
\\const x = 42;
|
||||
|
||||
@@ -2759,8 +2759,7 @@ fn tokenSliceForRender(tree: Ast, token_index: Ast.TokenIndex) []const u8 {
|
||||
var ret = tree.tokenSlice(token_index);
|
||||
switch (tree.tokens.items(.tag)[token_index]) {
|
||||
.multiline_string_literal_line => {
|
||||
assert(ret[ret.len - 1] == '\n');
|
||||
ret.len -= 1;
|
||||
if (ret[ret.len - 1] == '\n') ret.len -= 1;
|
||||
},
|
||||
.container_doc_comment, .doc_comment => {
|
||||
ret = mem.trimRight(u8, ret, &std.ascii.whitespace);
|
||||
|
||||
Reference in New Issue
Block a user