Documentation for CSharpSyntaxWalker constructor needs clarification of "depth" parameter
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 68/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- csharp
调研方向
从 dotnet/xml/Microsoft.CodeAnalysis.CSharp/CSharpSyntaxWalker.xml 开始,查看 issue 中指定的 Content Source,并检查 CSharpSyntaxWalker 构造函数、类和 Depth 属性条目。更新文档,以说明 Depth 的默认行为、token 和 trivia 的访问方式,以及 Depth 的含义;完成的标准是每个请求的 API 页面都清楚地描述这些行为。
由索引模型根据 Issue 内容生成。
描述
Currently, in a derived syntax walker without an explicit constructor, the syntax walker will not visit tokens or trivia nodes. This is extremely non-obvious.
I wasted about half a day discovering this behavior, confirming it, opening an issue, discovering the underlying cause, and then closing the issue (see #66713).
The documentation desperately needs improvements in this regard.
First, the Constructor page should better explain both the usage and the default value of the terribly named depth parameter. Currently, it lists only the name and data type of the parameter and no additional information. I suggest adding something like the following:
The value of this parameter limits the types of nodes that will be visited. With its default value of
SyntaxWalkerDepth.Node, neither tokens nor trivia are visited.
Next, the Class page should warn that by default this class will not visit tokens or trivia nodes. I suggest adding something like the following:
By default, this class will not visit tokens or trivia. To change this behavior, supply a different value for the
depthparameter of the constructor.
Next, on the same page, the documentation for the Depth property should be improved. Currently, it only provides the property name and no further information. I suggest adding something like the following:
Gets a value that indicates the types of nodes that will be visited.
Finally, on the Property page for Depth, a similar description should be added. Currently, it only provides the name and data type and no further information.
Regarding the poor naming of the parameter and property, the word "depth" generally has a different meaning when referring to a tree data structure. There, it is a measure of the distance between a given node and the root of the tree.
In this class, the name depth refers to a filter that limits the types of nodes that will be visited. While this loosely relates to the previously mentioned concept of "depth", since descent stops at the depth where a node does not match the filter, it is nonetheless poorly named.
Better names include: "depthLimit", "depthFilter", "filter", "limit", and frankly almost anything else 😄
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
- ID: 7f4df4eb-e177-be67-06f2-6cd65d8cbac9
- Version Independent ID: 0b46d8cb-407a-94ed-a5a0-13528960b2a9
- Content: CSharpSyntaxWalker Class (Microsoft.CodeAnalysis.CSharp)
- Content Source: dotnet/xml/Microsoft.CodeAnalysis.CSharp/CSharpSyntaxWalker.xml
- Product: dotnet-roslyn-api
- Technology: microsoft.codeanalysis
- GitHub Login: @dotnet-bot
- Microsoft Alias: dotnetcontent
- 主要语言
- 没有语言数据
- 星标
- 4.8k
- 派生
- 6.1k
- 平均合并
- 1 天 3 小时
- 30 天内合并 PR
- 167
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dotnet/docs 的其他 Issue
-
dg未关闭:watch: Not Triaged dotnet-fundamentals/svc
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
Document unit-test / theory-data impact of .NET 11 double→decimal conversion可能已有人在做 @SkyDevLab 于 3 天前认领。 未关闭:watch: Not Triaged dotnet-fundamentals/svc
难度 1/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
:watch: Not Triaged dotnet-fundamentals/svc
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
dotnet-fundamentals/svc install/subsvc
难度 2/5 1-3 小时 新手友好度 72/100
dotnet/docs#56344 · 1 个 reaction ·
维护者通常 1 天内回复
-
Upgrade from `net9.0` to LTS (or STS) image tag可能已有人在做 @ShyneChikwapulo 于 11 天前认领。 未关闭dotnet-target-version
难度 1/5 1 小时以内 新手友好度 85/100
dotnet/docs#56293 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
aws-samples/sample-per-model-bedrock#526 ·
维护者通常 1 天内回复
-
难度 2/5 1 小时以内 新手友好度 90/100
elder-plinius/V3R1T4S#757 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 68/100
EleutherAI/lm-evaluation-harness#4460 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
openpubkey/opkssh#670 ·
维护者通常 1 天内回复
-
documentation
难度 2/5 1-3 小时 新手友好度 70/100
registrystack/registry-stack#2431 ·
维护者通常 1 天内回复