Skip to content

Commit 4da1457

Browse files
authored
Merge pull request #598 from ahoppen/pr/raw-recursive-description
Add `recursiveDescription` to `RawSyntaxNodeProtocol`
2 parents 64d5004 + d87b590 commit 4da1457

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/SwiftSyntax/Syntax.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,3 +770,12 @@ extension SyntaxNode: CustomStringConvertible, TextOutputStreamable {
770770
raw.write(to: &target)
771771
}
772772
}
773+
774+
/// Expose `recursiveDescription` on raw nodes for debugging purposes.
775+
extension RawSyntaxNodeProtocol {
776+
/// Print this raw syntax node including all of its children.
777+
/// Intended for debugging purposes only.
778+
var recursiveDescription: String {
779+
return Syntax(raw: raw).recursiveDescription
780+
}
781+
}

0 commit comments

Comments
 (0)