diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tree/mod.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/tree/mod.rs b/src/tree/mod.rs index 795f23f42..4131d855d 100644 --- a/src/tree/mod.rs +++ b/src/tree/mod.rs | |||
@@ -106,7 +106,19 @@ impl<'f> Node<'f> { | |||
106 | 106 | ||
107 | impl<'f> fmt::Debug for Node<'f> { | 107 | impl<'f> fmt::Debug for Node<'f> { |
108 | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | 108 | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
109 | write!(fmt, "{:?}@{:?}", self.kind(), self.range()) | 109 | write!(fmt, "{:?}@{:?}", self.kind(), self.range())?; |
110 | if has_short_text(self.kind()) { | ||
111 | write!(fmt, " \"{}\"", self.text())?; | ||
112 | } | ||
113 | Ok(()) | ||
114 | } | ||
115 | } | ||
116 | |||
117 | fn has_short_text(kind: SyntaxKind) -> bool { | ||
118 | use syntax_kinds::*; | ||
119 | match kind { | ||
120 | IDENT | LIFETIME => true, | ||
121 | _ => false | ||
110 | } | 122 | } |
111 | } | 123 | } |
112 | 124 | ||