GDQuest / GDQuest/GDScript-formatter
Discussion: hugging formatting for dictionaries and using commas as formatting hint
- Dominant language
- Rust
- Stars
- 455
- Forks
- 39
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 4
Description
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
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.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- godot, rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100