Improve formatting of heredoc/nowdoc
まだ誰も着手していません。
評価
調査の方向性
heredoc と nowdoc のフォーマットに関するリンク先の playground の例から始め、現在の出力と想定される出力を比較します。完了の条件は、開始タグが単独の行にあるかコードに続いているかに応じて、formatter が内容と終了タグを一貫して揃え、示されているケースをカバーすることです。
索引モデルが issue の本文から書いたものです。
説明
As suggested in https://github.com/prettier/plugin-php/issues/1274#issuecomment-570709723:
I'd say, it would be The Prettier Way™ (and also the prettier way ) to figure out one way to print heredocs and to enforce that.
One process which sounds reasonable to me: If the starting tag goes on its own line, align the content with that. Otherwise indent it one
tabWidthfurther.Examples of the described rule
Example 1
The heredoc-opening tag goes on its own line.
Input:
some_function(<<<'EOT' Hello World! EOT );Current output:
some_function( <<<'EOT' Hello World! EOT );Envisioned output:
some_function( <<<'EOT' Hello World! EOT );Example 2
The heredoc-opening tag goes on the same line as the preceding code.
Input:
$string = <<<'EOT' Hello World! EOT;Current output:
$string = <<<'EOT' Hello World! EOT;Envisioned output:
$string = <<<'EOT' Hello World! EOT;
The first example is actually already printed correctly, but the second one isn't (playground)
- 主要言語
- PHP
- スター
- 1.9k
- フォーク
- 139
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
prettier/plugin-php のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
prettier/plugin-php#2416 · コメント 2 件 · リアクション 6 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 64/100
prettier/plugin-php#2498 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
prettier/plugin-php#2495 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
prettier/plugin-php#2494 · コメント 1 件 ·
-
strange format issue オープン
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
prettier/plugin-php#2490 ·
prettier/plugin-php の issue をすべて見る
似ている issue
-
tooling
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
UX
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
ProfessionalWiki/NeoWiki#1525 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
bug customer-reported
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
MagnaCapax/PMSS#949 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Automattic/static-site-importer#1829 ·