Export in combinantion with setter cause very weird behaviour
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 65/100
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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di GDQuest/GDScript-formatter
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
GDQuest/GDScript-formatter#362 · 2 commenti ·
-
Godot 4.8.dev6 Parse Error Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
GDQuest/GDScript-formatter#359 · 9 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
GDQuest/GDScript-formatter#327 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
GDQuest/GDScript-formatter#360 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
GDQuest/GDScript-formatter#354 · 2 commenti ·
Tutte le issue di GDQuest/GDScript-formatter
Issue simili
-
Replayed reasoning items send "content": null, which the Responses API schema does not permit Apertabug CLI custom-model
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
rust-bitcoin/rust-bitcoin#6930 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
fulcrumgenomics/ferro-hgvs#2251 ·
-
A-allocators A-docs C-enhancement T-libs
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100