Skip to content

Commit 57c4d29

Browse files
committed
Function annotations: preserve input formatting and allow inline annotations with function definitions
Close #118
1 parent 95bc571 commit 57c4d29

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

queries/gdscript.scm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
. (comment)? @do_nothing)
170170

171171
(comment) @append_empty_softline @prepend_input_softline
172-
(region_start) @append_empty_softline @prepend_input_softline
172+
(region_start) @append_empty_softline @prepend_input_softline
173173
(region_end) @append_empty_softline @prepend_input_softline
174174

175175
; Allow one blank line before following statements
@@ -238,7 +238,6 @@
238238
(annotation) @append_space
239239
((annotation (identifier) @append_space) @append_empty_softline . (comment)? @do_nothing (#not-match? @append_space "^(onready|export)$"))
240240
(annotation (arguments "(" @prepend_antispace))
241-
(function_definition (annotations (annotation) @append_hardline))
242241

243242
; This is used to preserve new lines after semicolons for people who use them on
244243
; all code lines

tests/expected/function_annotations.gd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
@rpc
2-
func foo():
1+
@abstract func foo():
32
pass
43

54

tests/input/function_annotations.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@rpc func foo():
1+
@abstract func foo():
22
pass
33

44

0 commit comments

Comments
 (0)