aboutsummaryrefslogtreecommitdiff
path: root/src/tree
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-01-28 20:13:32 +0000
committerAleksey Kladov <[email protected]>2018-01-28 20:13:32 +0000
commitc23a2519e18ab1cd8c09c6b25d1c1c8ab9a1f3c1 (patch)
treea3a42f0943860a650a9f149725c76e8c50514908 /src/tree
parentb7c141e0b5c66c51db7171b1de30d4c60d1048c0 (diff)
Print identifiers in test data
Diffstat (limited to 'src/tree')
-rw-r--r--src/tree/mod.rs14
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
107impl<'f> fmt::Debug for Node<'f> { 107impl<'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
117fn 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