aboutsummaryrefslogtreecommitdiff
path: root/code/native/src
diff options
context:
space:
mode:
Diffstat (limited to 'code/native/src')
-rw-r--r--code/native/src/lib.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/code/native/src/lib.rs b/code/native/src/lib.rs
index dcf478cf5..068767fab 100644
--- a/code/native/src/lib.rs
+++ b/code/native/src/lib.rs
@@ -7,6 +7,7 @@ use libsyntax2::{
7 File, 7 File,
8 utils::dump_tree, 8 utils::dump_tree,
9 SyntaxKind::*, 9 SyntaxKind::*,
10 algo,
10}; 11};
11use neon::prelude::*; 12use neon::prelude::*;
12 13
@@ -17,11 +18,12 @@ pub struct Wrapper {
17impl Wrapper { 18impl Wrapper {
18 fn highlight(&self) -> Vec<(TextRange, &'static str)> { 19 fn highlight(&self) -> Vec<(TextRange, &'static str)> {
19 let mut res = Vec::new(); 20 let mut res = Vec::new();
20 self.inner.for_each_node(|node| { 21 let syntax = self.inner.syntax();
22 for node in algo::walk::preorder(syntax.as_ref()) {
21 if node.kind() == ERROR { 23 if node.kind() == ERROR {
22 res.push((node.range(), "error")) 24 res.push((node.range(), "error"))
23 } 25 }
24 }); 26 }
25 res 27 res
26 } 28 }
27} 29}