zig fmt: respect extra newline between fn and pub usingnamespace
This commit is contained in:
@@ -321,7 +321,6 @@ pub const Tree = struct {
|
||||
while (true) switch (tags[n]) {
|
||||
.root => return 0,
|
||||
|
||||
.@"usingnamespace",
|
||||
.test_decl,
|
||||
.@"errdefer",
|
||||
.@"defer",
|
||||
@@ -468,6 +467,14 @@ pub const Tree = struct {
|
||||
return i - end_offset;
|
||||
},
|
||||
|
||||
.@"usingnamespace" => {
|
||||
const main_token = main_tokens[n];
|
||||
if (main_token > 0 and token_tags[main_token - 1] == .keyword_pub) {
|
||||
end_offset += 1;
|
||||
}
|
||||
return main_token - end_offset;
|
||||
},
|
||||
|
||||
.async_call_one,
|
||||
.async_call_one_comma,
|
||||
.async_call,
|
||||
|
||||
@@ -4178,17 +4178,16 @@ test "zig fmt: for loop with ptr payload and index" {
|
||||
// );
|
||||
//}
|
||||
|
||||
// TODO
|
||||
//test "zig fmt: respect extra newline between fn and pub usingnamespace" {
|
||||
// try testCanonical(
|
||||
// \\fn foo() void {
|
||||
// \\ bar();
|
||||
// \\}
|
||||
// \\
|
||||
// \\pub usingnamespace baz;
|
||||
// \\
|
||||
// );
|
||||
//}
|
||||
test "zig fmt: respect extra newline between fn and pub usingnamespace" {
|
||||
try testCanonical(
|
||||
\\fn foo() void {
|
||||
\\ bar();
|
||||
\\}
|
||||
\\
|
||||
\\pub usingnamespace baz;
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
// TODO
|
||||
//test "zig fmt: respect extra newline between switch items" {
|
||||
|
||||
Reference in New Issue
Block a user