Improper body indentation for split inline tags
まだ誰も着手していません。
評価
調査の方向性
まず、提示された PHP 入力を、記載された Prettier および PHP プラグインの設定で再現し、次に分割されたインラインタグとその中に埋め込まれた式がどのようにフォーマットされるかを追跡します。分割された式が一貫したインデントを使用し、この例に対するリグレッションケースで選択した動作がカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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).
- 主要言語
- 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
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
OpenConext/OpenConext-engineblock#2122 ·
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Automattic/safe-publish#594 ·