GDQuest / GDQuest/GDScript-formatter

Discussion: hugging formatting for dictionaries and using commas as formatting hint

Aperta
#310 3 commenti 3 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
455
Fork
39
Merge medio
1g 15h
PR unite (30g)
4

Descrizione

The following code:
```gdscript
for i in range(3):
properties.append({
"name": "number_%d" % i,
"type": TYPE_INT,
"hint": PROPERTY_HINT_ENUM,
"hint_string": "ZERO,ONE,TWO,THREE,FOUR,FIVE",
})
```

Will be formatted like this:

```gdscript
for i in range(3):
properties.append(
{
"name": "number_%d" % i,
"type": TYPE_INT,
"hint": PROPERTY_HINT_ENUM,
"hint_string": "ZERO,ONE,TWO,THREE,FOUR,FIVE",
}
)
```

But I think the original version reads better. I took the code from [this](https://docs.godotengine.org/en/stable/classes/class_object.html#class-object-private-method-get-property-list) example.

Also if the dictionary is shorter (I just removed the last line from the previous example):
```gdscript
for i in range(3):
properties.append({
"name": "number_%d" % i,
"type": TYPE_INT,
"hint": PROPERTY_HINT_ENUM,
})
```

It will be formatted like this:
```gdscript
for i in range(3):
properties.append({ "name": "number_%d" % i, "type": TYPE_INT, "hint": PROPERTY_HINT_ENUM })
```

But I'd expect the shape to be preserved since I have a comma at the end.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start by reproducing the two dictionary-formatting examples from the issue with the GDScript formatter and compare the output with the requested layouts. Trace the formatter behavior responsible for multiline dictionaries, trailing commas, and inline dictionaries; done means the examples preserve the intended shape and existing formatting behavior remains intact.

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

Valutazione

Stack tecnologico
godot, rust
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.