prettier / prettier/plugin-php
Improper body indentation for split inline tags
まだ誰も着手していません。
- 主要言語
- PHP
- スター
- 1.9k
- フォーク
- 139
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Prettier 2.2.1
PHP Plugin 0.16.1
{
"printWidth": 100,
"useTabs": true,
"semi": true,
"quoteProps": "consistent",
"trailingComma": "all",
"phpVersion": "7.4",
"braceStyle": "1tbs"
}
Input:
<div>
<p> some html </p>
<div>
<p>some more html with an inline element <?= htmlspecialchars("test") ?> and another inline element <?= htmlspecialchars("test") ?> with even more <?= htmlspecialchars("test") ?></p>
</div>
</div>
Output:
<div>
<p> some html </p>
<div>
<p>some more html with an inline element <?= htmlspecialchars(
"test",
) ?> and another inline element <?= htmlspecialchars(
"test",
) ?> with even more <?= htmlspecialchars("test") ?></p>
</div>
</div>
Expected behavior:
This is an issue of opinion so there are multiple solutions here, however, I think everyone would agree that all the parts should be indented the same (or at least identically).

The two htmlspecialchars that got split have different amounts of indentation on their closing parenthesis. Additionally, I would argue that the entire block should be indented the same, even if it produced something weird like:
<p>some more html with an inline element <?= htmlspecialchars(
"test",
) ?> and another inline element <?= htmlspecialchars(
"test",
) ?> with even more <?= htmlspecialchars("test") ?></p>
(which is weird HTML with the <p> being on the same line of a multi-line body, however, this is a PHP prettier plugin, not HTML).
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、提示された PHP 入力を、記載された Prettier および PHP プラグインの設定で再現し、次に分割されたインラインタグとその中に埋め込まれた式がどのようにフォーマットされるかを追跡します。分割された式が一貫したインデントを使用し、この例に対するリグレッションケースで選択した動作がカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- php
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100