From c23a2519e18ab1cd8c09c6b25d1c1c8ab9a1f3c1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 28 Jan 2018 23:13:32 +0300 Subject: Print identifiers in test data --- src/tree/mod.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/tree') 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> { impl<'f> fmt::Debug for Node<'f> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - write!(fmt, "{:?}@{:?}", self.kind(), self.range()) + write!(fmt, "{:?}@{:?}", self.kind(), self.range())?; + if has_short_text(self.kind()) { + write!(fmt, " \"{}\"", self.text())?; + } + Ok(()) + } +} + +fn has_short_text(kind: SyntaxKind) -> bool { + use syntax_kinds::*; + match kind { + IDENT | LIFETIME => true, + _ => false } } -- cgit v1.2.3