Skip to content

Regression: --reorder-code places class name before @tool annotation #285

Description

@portlek

Description:
The --reorder-code flag reorders @tool after class_name, which breaks the script's syntax. In GDScript, @tool must appear before class_name and extends.

Input:

@tool
extends RefCounted
class_name Test

func _init() -> void:
	pass

Command:

gdscript-formatter --reorder-code

Output:

class_name Test
@tool
extends RefCounted


func _init() -> void:
	pass

Expected:

The @tool annotation should remain at the top, before class_name and extends.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions