More consistent raws convention for trailing whitespace
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- typescript
- 領域
- tooling
調査の方向性
No files or tests are named. Start by tracing how Container.raws.after, AtRule.raws.between, and Declaration.raws.value.raw are populated and consumed, then compare the parser and serializer behavior for trailing whitespace with and without semicolons. Done means the proposed raws conventions are implemented consistently and covered by tests, including the lower-priority AtRule rename if accepted.
索引モデルが issue の本文から書いたものです。
説明
This is a request to support https://github.com/sass/dart-sass/issues/88.
There are a few inconsistencies and difficulties in the way raws work with trailing whitespace. For my purposes the main issue here is that these make it hard to expand on the rules in a PostCSS-compatible Sass parser, but I imagine the inconsistencies also make it difficult to work with raws in general. In particular:
-
raws.betweenrepresents substantially different content for at-rules (where it represents the whitespace after the rule's params) and declarations (where it represents the whitespace and colon after the declaration's name). This makes it difficult to share formatting logic between at-rules and declarations. -
Declarations and at-rules use different raws conventions for the final node in a block when that node doesn't have a semicolon. In particular,
a {@foo }puts the two spaces inAtRule.raws.between, whilea {foo: bar }puts the two spaces inRule.raws.after. -
At-rules have an explicit representation of trailing whitespace that's distinct from the value of the rule in
AtRule.raws.between, but declarations do not. Instead, trailing whitespace in declarations is represented as trailing whitespace inDeclaration.raws.value.raw. This makes it difficult to change the declaration's value while preserving the whitespace.
The final bullet point is particularly problematic for any tool that tries to expose a parsed view of a declaration value in a way that matches the PostCSS API. This view has to be responsible for maintaining all the formatting intrinsic in Declaration.raws.value.raw, which means it must somehow track the trailing whitespace. However, this poses a serious issue: the PostCSS convention for raws in the common case of nodes immediately followed by semicolons or blocks is that a given node tracks the whitespace before it but not after it. If each expression node has to track whitespace after it, then that ends up working substantially differently than PostCSS.
I propose the following changes:
-
Make
Container.raws.afteralways contain the whitespace between}and the previous semicolon, block, or node, whichever is closer. This matches the current behavior of declarations, nested style rules, and at-rules with blocks or semicolons. It only changes the behavior of at-rules without semicolons. -
Add
Declaration.raws.afterValue, which holds any whitespace between the declaration value and the semicolon. If there is no semicolon, this is parsed as the empty string and the whitespace is inContainer.raws.afterinstead. -
(Lower priority) Rename
AtRule.raws.betweento.afterValueto make it fully analogous toDeclaration.raws.afterValue.
- 主要言語
- TypeScript
- スター
- 29k
- フォーク
- 1.8k
- 平均マージ
- 18時間 58分
- マージ済み PR(30日)
- 9
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
postcss/postcss のほかの issue
-
Put opnly `major.minor` in `Processor.version`対応中かも @MahinAnowar が 144 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
Multiple BOM symbols inside generated css in v8.5.24対応中かも @arronKler が 104 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 50/100
postcss/postcss#2133 · コメント 9 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Remove colors lib対応中かも @mrpmohiburrahman が 100 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
-
Add a way to create plugins in TypeScript再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
postcss/postcss#2102 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
postcss/postcss#2053 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
postcss/postcss の issue をすべて見る
似ている issue
-
bug zoo
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
software-mansion/runntime#151 ·
メンテナーはふだん 4 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 86/100
sidebandstudio/clawtrate#728 ·
メンテナーはふだん 1 日以内に返信
-
enhancement github_actions help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
tranquilo-art/tranquilo-app#254 ·
メンテナーはふだん 1 日以内に返信
-
docs good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 87/100
DojoCodingLabs/hermit#73 ·
メンテナーはふだん 1 日以内に返信
-
documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
Tfoucher5/fuzzy-toolkit#44 ·
メンテナーはふだん 1 日以内に返信