Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Export in combinantion with setter cause very weird behaviour

Aperta
#361 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
devtools

Direzione di ricerca

Look at the formatting logic for @export annotations combined with property setters in GDScript. The issue shows the formatter cycles between different layouts. Start by finding where export statements are parsed and formatted, likely in a module handling annotations or property declarations. Run the formatter on the provided code snippets to observe the non-deterministic behavior, then trace through the formatting decisions to see why it doesn't stabilize.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Ok, this is a really strange one.
The reformatter seems to be non deterministic in some cases.

Below I write a step by step guide to reproduce. I think that's best to follow through.

My initial code is:

@export_range(0., 500., .1, "or_greater", "suffix:m")
var max_distance_test: float = 200.:
	set(value):
		max_distance_test = value

Call reformatter and it changes it to:

@export_range(0., 500., .1, "or_greater", "suffix:m") var max_distance_test: float = 200.:
	set(value):
		max_distance_test = value

Call reformatter again and it changes it to:

@export_range(
	0.,
	500.,
	.1,
	"or_greater",
	"suffix:m",
) var max_distance_test: float = 200.:
	set(value):
		max_distance_test = value

While the last one looks plain ugly, I think the initial one should have been already correct.
If the reformatting is indeed desired, it should have stopped after the first iteration, because the line length is not reached yet.

If I take the last one and simply add a line break before var:

@export_range(
	0.,
	500.,
	.1,
	"or_greater",
	"suffix:m",
)
var max_distance_test: float = 200.:
	set(value):
		max_distance_test = value

Call reformatter again and it changes it back to the second iteration:

@export_range(0., 500., .1, "or_greater", "suffix:m") var max_distance_test: float = 200.:
	set(value):
		max_distance_test = value

From where a simple reformat call again brings us back to the ugly one.

In my script there are a bunch of such properties, therefore it is quite annoying that the reformatting can not decide on a layout.
Further more, any property without setter is left alone.

Lingua principale
Rust
Stelle
458
Fork
40
Merge medio
1g 15h
PR unite (30g)
4

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di GDQuest/GDScript-formatter

Tutte le issue di GDQuest/GDScript-formatter

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.