-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Document ordering of SyntaxNode Ancestor methods #81857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
|
@dotnet/roslyn-compiler for more eyes. |
FYI, the PR is in Draft state and doesn't have any labels |
jcouv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks (commit 2)
|
Can be merged with a single review single doc-only change. Thanks |
Good to know. Thanks! |
The XML documentation for
Ancestors(),AncestorsAndSelf(), andFirstAncestorOrSelf()methods did not specify the traversal order, while similar methods likeDescendantNodes()explicitly document ordering as "in prefix document order."Changes
Updated XML documentation for four public methods in
SyntaxNode:Ancestors(): Returns "ancestor nodes in order from the innermost containing syntactic ancestor to the outermost"AncestorsAndSelf(): Returns "ancestor nodes (including this node) in order from this node to the outermost ancestor"FirstAncestorOrSelf<TNode>(): Clarifies "ancestors are searched in order from this node to the outermost ancestor"FirstAncestorOrSelf<TNode, TArg>(): Same clarification as aboveExample
This ordering allows reliable use of LINQ methods like
.First()to get the immediate parent or closest matching ancestor.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
kijvsblobprodcus387.vsblob.vsassets.io/usr/share/dotnet/dotnet dotnet build src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj --no-incremental /home/REDACTED/work/roslyn/roslyn/src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/Engine/DkmSuccessEvaluationResult.cs /home/REDACTED/work/roslyn/roslyn/src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/Engine/DkmCompilerId.cs /home/REDACTED/work/roslyn/roslyn/src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/Engine/DkmClrAppDomain.cs /home/REDACTED/work/roslyn/roslyn/src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/Engine/IDkmClrFormatter.cs /home/REDACTED/work/roslyn/roslyn/src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/Engine/DkmEvaluationResultFlags.cs /home/REDACTED/work/roslyn/roslyn/src/ExpressionEvaluator/Core/Test/ResultProvider/Deb�� /home/REDACTED/work/roslyn/roslyn/src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/Engine/DkmDataItem.cs /home/REDACTED/work/roslyn/roslyn/src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/Engine/DkmEvaluationFlags.cs(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.