Block-style formatting for integer literal arrays

オープン
#191 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
rust
領域
tooling

調査の方向性

まず、定数配列の構築に関する既存の formatter の動作と、issue #168 の議論を読んでください。ブロックモード、行の長さに基づく折り返し、整数リテラルのヒューリスティクス、しきい値、設定、コメントに基づく改行をどのように指定するべきかを判断してください。動作について合意され、大きな整数リテラルの配列が、各要素を1行に1つずつ配置することを強制せずに、読みやすいブロックにフォーマットされれば完了です。

索引モデルが issue の本文から書いたものです。

説明

enhancement

Continuing the discussion from #168.

Sometimes large quantities of arguments are a necessity. For example, a constant array construction:

const
  Log2DeBruijn: array[0..31] of Byte = (
    00, 09, 01, 10, 13, 21, 02, 29, //
    11, 14, 16, 18, 22, 25, 03, 30, //
    08, 12, 20, 28, 15, 17, 24, 07, //
    19, 27, 23, 06, 26, 05, 04, 31 //
  );

With the current formatting, each element in the array would be wrapped onto its own line. With large element quantities, this can easily explode a unit's line count and degrade readability.

A proposed solution is to:

  • Using some heuristics, enter a "block" mode for elements. Suggestions include:
    • If all elements are integer literals
    • If all elements are shorter than a configured length
    • If the element count is over some threshold
  • Continue placing elements inline until over the line length, then break
    • Allow users to use // to break the line, as seen above (don't force 1-per-line like prettier though)
主要言語
Rust
スター
108
フォーク
20
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

integrated-application-development/pasfmt のほかの issue

integrated-application-development/pasfmt の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。