aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_editor/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_editor/src/lib.rs')
-rw-r--r--crates/ra_editor/src/lib.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_editor/src/lib.rs b/crates/ra_editor/src/lib.rs
index 412b8aea9..b03f9ea54 100644
--- a/crates/ra_editor/src/lib.rs
+++ b/crates/ra_editor/src/lib.rs
@@ -67,11 +67,11 @@ pub fn matching_brace(file: &SourceFileNode, offset: TextUnit) -> Option<TextUni
67 Some(matching_node.range().start()) 67 Some(matching_node.range().start())
68} 68}
69 69
70pub fn highlight(file: &SourceFileNode) -> Vec<HighlightedRange> { 70pub fn highlight(root: SyntaxNodeRef) -> Vec<HighlightedRange> {
71 // Visited nodes to handle highlighting priorities 71 // Visited nodes to handle highlighting priorities
72 let mut highlighted = FxHashSet::default(); 72 let mut highlighted = FxHashSet::default();
73 let mut res = Vec::new(); 73 let mut res = Vec::new();
74 for node in file.syntax().descendants() { 74 for node in root.descendants() {
75 if highlighted.contains(&node) { 75 if highlighted.contains(&node) {
76 continue; 76 continue;
77 } 77 }
@@ -143,7 +143,7 @@ fn main() {}
143 println!("Hello, {}!", 92); 143 println!("Hello, {}!", 92);
144"#, 144"#,
145 ); 145 );
146 let hls = highlight(&file); 146 let hls = highlight(file.syntax());
147 assert_eq_dbg( 147 assert_eq_dbg(
148 r#"[HighlightedRange { range: [1; 11), tag: "comment" }, 148 r#"[HighlightedRange { range: [1; 11), tag: "comment" },
149 HighlightedRange { range: [12; 14), tag: "keyword" }, 149 HighlightedRange { range: [12; 14), tag: "keyword" },