godot-gdscript-toolkit icon indicating copy to clipboard operation
godot-gdscript-toolkit copied to clipboard

Formatter adds extraneous newlines after annotations above functions

Open voithos opened this issue 1 year ago • 1 comments
trafficstars

Currently, when a function has an annotation such as @warning_ignore written above it, gdformat will add newlines in between the function and the annotation.

Example input (which I would expect to be largely unchanged):

func okfunc() -> void:
	pass


@warning_ignore("unused_parameter")
func testfunc(some_param: int) -> void:
	pass

Current output:

func okfunc() -> void:
	pass


@warning_ignore("unused_parameter")


func testfunc(some_param: int) -> void:
	pass

voithos avatar Jan 11 '24 06:01 voithos

Well, looks like @warning_ignore works with function headers now... I knew this day would come :) In short, @warning_ignore is treated as a standalone annotation for now and therefore it's separated from function in your example. Looks like it will have to be context-aware now. Thanks for reporting!

Scony avatar Jan 11 '24 22:01 Scony