Skip to content

Commit 2ec25ab

Browse files
committed
Fix formatting of comments after some global decls
1 parent 55e8814 commit 2ec25ab

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

corpus/comments.spicy

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
public type A = B; # Should stay here.
2+
3+
public type A = unit {}; # Should stay here.
4+
public type A = struct {}; # Should stay here.
5+
6+
function f() {} # Should stay here.

corpus/comments.spicy.expected

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
public type A = B; # Should stay here.
2+
3+
public type A = unit {}; # Should stay here.
4+
public type A = struct {}; # Should stay here.
5+
6+
function f() {} # Should stay here.

src/query.scm

+11-7
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,17 @@
223223
(import)
224224
] @allow_blank_line_before
225225

226-
[
227-
(enum_decl)
228-
(type_decl)
229-
(function_decl)
230-
(struct_decl)
231-
]
232-
@append_hardline
226+
(
227+
[
228+
(enum_decl)
229+
(type_decl)
230+
(function_decl)
231+
(struct_decl)
232+
]
233+
@append_hardline
234+
.
235+
(comment)? @do_nothing
236+
)
233237

234238
[
235239
(field_decl)

0 commit comments

Comments
 (0)