Trailing comma in AST
まだ誰も着手していません。
評価
調査の方向性
まず、Prism における ArrayNode と HashNode の処理、および rubyfmt が Prism の AST をどのように利用しているかを確認します。既存のフォーマット動作を変更せずに、これらのノードについて末尾のカンマの有無を表現できるか調査します。Prism がこの情報を追跡すべきかどうかについて、具体的な推奨事項を文書化できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
For background, Stripe uses rubyfmt to format Ruby. One thing rubyfmt doesn't have today is trailing commas: all trailing commas are stripped by formatting, which is the preference of the maintainers of that project.
For a while I've wished for something like "rubyfmt + trailing commas." Before it even makes sense to have the conversation about whether to make that change, I was thinking through what it would even look like in practice. One thing which would make things easier to adopt would be if rubyfmt could run in a mode that preserves trailing commas, rather than universally adding or removing them (you could migrate slices of a codebase at a time, instead of having to land a PR touching hundreds of thousands of files all at once).
rubyfmt now uses prism for parsing Ruby files, and prism omits information about whether various constructs had trailing commas.
I was curious to get a temperature check on whether this is something that prism would ever want to see tracked. For example, in ArrayNode or in HashNode, to have some way to know that the user had written a trailing comma.
This is a very "what if" sort of line of thought, so please don't feel rushed to answer, and also I completely understand if the answer is definitively "that's not something prism is open to incorporating."
- 主要言語
- C
- スター
- 1k
- フォーク
- 194
- 平均マージ
- 2日 6時間
- マージ済み PR(30日)
- 15
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ruby/prism のほかの issue
-
Revisit comments オープンenhancement
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
-
java
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
java
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
java
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
bradcypert/plum#53 ·
-
Component: GLib
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Status: Opened
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
nextbsd/nextbsd-userland#285 ·