Skip to content

Commit 1d0ad16

Browse files
committed
Add recursiveDescription to RawSyntaxNodeProtocol
Having `recursiveDescription` is really useful for debugging purposes.
1 parent 23d38a1 commit 1d0ad16

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/SwiftSyntax/RawSyntaxNodeProtocol.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ public extension RawSyntaxNodeProtocol {
4242
func write<Target>(to target: inout Target) where Target : TextOutputStream {
4343
raw.write(to: &target)
4444
}
45+
46+
/// Print this raw syntax node including all of its children.
47+
/// Intended for debugging purposes only.
48+
var recursiveDescription: String {
49+
return Syntax(raw: raw).recursiveDescription
50+
}
4551
}
4652

4753
/// `RawSyntax` itself conforms to `RawSyntaxNodeProtocol`.

0 commit comments

Comments
 (0)