GDQuest / GDQuest/GDScript-formatter
Discussion: hugging formatting for dictionaries and using commas as formatting hint
- 主要言語
- Rust
- スター
- 455
- フォーク
- 39
- 平均マージ
- 1日 15時間
- マージ済み PR(30日)
- 4
説明
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.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
まず、Issue にある 2 つの辞書フォーマット例を GDScript formatter で再現し、出力を要求されたレイアウトと比較します。複数行の辞書、末尾のコンマ、インライン辞書を担当する formatter の動作を追跡します。例が意図した形を維持し、既存のフォーマット動作が損なわれないことが完了の条件です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- godot, rust
- 領域
- tooling
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 55/100