parseTree - Option to keep comments
@aeschli がすでに取り組んでいます。
2019年10月28日 から。
評価
この issue はまだ評価されていません。
説明
Thanks for this library! I wrote a jsonc code formatter using it.
Right now I'm using the scanner to get the comments around the nodes in the tree. It would be slightly faster to not rescan these out and instead get all the comments when calling parseTree.
A simple solution would may be to have an option that returns all the comments in an array. Maybe something like...
export function parseTree(text: string, errors: ParseError[] = [], options: ParseOptions = ParseOptions.DEFAULT): Node;
Goes to:
export function parseTree(text: string, options: ParseOptions = ParseOptions.DEFAULT): ParseResult;
interface ParseResult {
file: Node;
errors: ParseError[];
/** Included when `options.includeComments` is true. **/
comments?: Comment[];
};
Then:
export interface ParseOptions {
disallowComments?: boolean;
allowTrailingComma?: boolean;
allowEmptyContent?: boolean;
}
Goes to:
export interface ParseOptions {
disallowComments?: boolean;
includeComments?: boolean;
allowTrailingComma?: boolean;
allowEmptyContent?: boolean;
}
Thoughts? I could submit a PR for this, but will just need some direction on how the public API should look.
- 主要言語
- TypeScript
- スター
- 759
- フォーク
- 66
- 平均マージ
- 5日 10時間
- マージ済み PR(30日)
- 7
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/node-jsonc-parser のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
microsoft/node-jsonc-parser#125 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
microsoft/node-jsonc-parser#105 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
microsoft/node-jsonc-parser#103 · コメント 2 件 · リアクション 8 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 48/100
microsoft/node-jsonc-parser#97 · リアクション 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
microsoft/node-jsonc-parser#95 · リアクション 1 件 ·
microsoft/node-jsonc-parser の issue をすべて見る
似ている issue
-
Browser Waiting for: Product Owner
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
getsentry/sentry-javascript#24577 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
agilepathway/label-checker#640 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
copse-dev/agent-pane#2953 ·
-
agentic-workflows
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
githubnext/rig#534 ·
-
automation missing-model model-sync provider:pioneer
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
anomalyco/models.dev#7701 ·