Scony / godot-gdscript-toolkit

Independent set of GDScript tools - parser, linter, formatter, and more
MIT License
944 stars 65 forks source link

Formatter adds extraneous newlines after annotations above functions #267

Open voithos opened 7 months ago

voithos commented 7 months ago

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
Scony commented 7 months ago

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!