Skip to content

Commit d87b590

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

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
@@ -759,3 +759,12 @@ extension SyntaxNode: CustomStringConvertible, TextOutputStreamable {
759759
raw.write(to: &target)
760760
}
761761
}
762+
763+
/// Expose `recursiveDescription` on raw nodes for debugging purposes.
764+
extension RawSyntaxNodeProtocol {
765+
/// Print this raw syntax node including all of its children.
766+
/// Intended for debugging purposes only.
767+
var recursiveDescription: String {
768+
return Syntax(raw: raw).recursiveDescription
769+
}
770+
}

0 commit comments

Comments
 (0)