GDQuest / GDQuest/GDScript-formatter
Discussion: hugging formatting for dictionaries and using commas as formatting hint
- Vorherrschende Sprache
- Rust
- Sterne
- 455
- Forks
- 39
- Ø Merge
- 1 T. 15 Std.
- Gemergte PRs (30 T.)
- 4
Beschreibung
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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne damit, die beiden Beispiele zur Dictionary-Formatierung aus dem Issue mit dem GDScript formatter zu reproduzieren und die Ausgabe mit den angeforderten Layouts zu vergleichen. Verfolge das für mehrzeilige Dictionaries, abschließende Kommas und Inline-Dictionaries verantwortliche Verhalten des Formatters; fertig ist es, wenn die Beispiele die beabsichtigte Form bewahren und das bestehende Formatierungsverhalten intakt bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- godot, rust
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 55/100