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
- 平均合并
- 3 天 1 小时
- 30 天内合并 PR
- 6
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 48/100
microsoft/node-jsonc-parser#97 · 3 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 35/100
microsoft/node-jsonc-parser#95 · 1 个 reaction ·
查看 microsoft/node-jsonc-parser 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
Doist/todoist-cli#576 ·
维护者通常 1 天内回复
-
🐛 Bug supabase/cli
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
CopilotKit/aimock#491 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
agilepathway/label-checker#710 · 2 条评论 ·
维护者通常 1 天内回复