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 a65637d52..a293fec34 100644
--- a/crates/ra_editor/src/lib.rs
+++ b/crates/ra_editor/src/lib.rs
@@ -79,11 +79,11 @@ pub fn matching_brace(file: &SourceFileNode, offset: TextUnit) -> Option<TextUni
79 Some(matching_node.range().start()) 79 Some(matching_node.range().start())
80} 80}
81 81
82pub fn highlight(file: &SourceFileNode) -> Vec<HighlightedRange> { 82pub fn highlight(root: SyntaxNodeRef) -> Vec<HighlightedRange> {
83 // Visited nodes to handle highlighting priorities 83 // Visited nodes to handle highlighting priorities
84 let mut highlighted = FxHashSet::default(); 84 let mut highlighted = FxHashSet::default();
85 let mut res = Vec::new(); 85 let mut res = Vec::new();
86 for node in file.syntax().descendants() { 86 for node in root.descendants() {
87 if highlighted.contains(&node) { 87 if highlighted.contains(&node) {
88 continue; 88 continue;
89 } 89 }
@@ -178,7 +178,7 @@ fn main() {}
178 println!("Hello, {}!", 92); 178 println!("Hello, {}!", 92);
179"#, 179"#,
180 ); 180 );
181 let hls = highlight(&file); 181 let hls = highlight(file.syntax());
182 assert_eq_dbg( 182 assert_eq_dbg(
183 r#"[HighlightedRange { range: [1; 11), tag: "comment" }, 183 r#"[HighlightedRange { range: [1; 11), tag: "comment" },
184 HighlightedRange { range: [12; 14), tag: "keyword" }, 184 HighlightedRange { range: [12; 14), tag: "keyword" },