Pulse Works Studio

Parse Error: Unexpected identifier "tool" in class body.

tool is not a keyword. A script that runs in the editor starts with @tool.

Cause

Godot 3 used a tool keyword, usually on the first line. Godot 4 parses that word as an identifier in the class body and rejects it. @tool has to be the first statement so the editor executes the script.

Fix

@tool
extends Node2D

@export var length: float = 32.0:
	set(value):
		length = value
		queue_redraw()

Related

Godot Dev Tools is a Pulse Works Studio project. All error explainers.