Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Export in combinantion with setter cause very weird behaviour

Abierto
#361 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
65/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust
Área
devtools

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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de GDQuest/GDScript-formatter

Todos los issues de GDQuest/GDScript-formatter

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.