Export in combinantion with setter cause very weird behaviour
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 65/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Rust
- Estrellas
- 458
- Forks
- 40
- Merge medio
- 1 d 15 h
- PR fusionados (30 d)
- 4
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de GDQuest/GDScript-formatter
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
GDQuest/GDScript-formatter#362 · 2 comentarios ·
-
Godot 4.8.dev6 Parse Error Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
GDQuest/GDScript-formatter#359 · 9 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
GDQuest/GDScript-formatter#327 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 58/100
GDQuest/GDScript-formatter#360 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
GDQuest/GDScript-formatter#354 · 2 comentarios ·
Todos los issues de GDQuest/GDScript-formatter
Issues similares
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
yantrikos/yantrik-os#255 ·
-
Replayed reasoning items send "content": null, which the Responses API schema does not permit Abiertobug CLI custom-model
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
raphamorim/rio#1956 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
rust-bitcoin/rust-bitcoin#6930 · 1 comentario ·