diff options
author | Aleksey Kladov <[email protected]> | 2018-12-31 16:06:00 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-12-31 16:06:00 +0000 |
commit | 862c99d0d5ef7c791a9319fa76c436762d88460c (patch) | |
tree | 8430cf52c1d20f32b675274422c3fa97dab841b0 /crates/ra_analysis/src | |
parent | f1e8ebfbeb5f84405fb609e3841df02e270037c4 (diff) |
generalize highlighting to work with nodes
Diffstat (limited to 'crates/ra_analysis/src')
-rw-r--r-- | crates/ra_analysis/src/syntax_highlighting.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_analysis/src/syntax_highlighting.rs b/crates/ra_analysis/src/syntax_highlighting.rs index 38219da71..7e9139a74 100644 --- a/crates/ra_analysis/src/syntax_highlighting.rs +++ b/crates/ra_analysis/src/syntax_highlighting.rs | |||
@@ -9,14 +9,14 @@ use crate::{ | |||
9 | 9 | ||
10 | pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> { | 10 | pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> { |
11 | let source_file = db.source_file(file_id); | 11 | let source_file = db.source_file(file_id); |
12 | let mut res = ra_editor::highlight(&source_file); | 12 | let mut res = ra_editor::highlight(source_file.syntax()); |
13 | for macro_call in source_file | 13 | for macro_call in source_file |
14 | .syntax() | 14 | .syntax() |
15 | .descendants() | 15 | .descendants() |
16 | .filter_map(ast::MacroCall::cast) | 16 | .filter_map(ast::MacroCall::cast) |
17 | { | 17 | { |
18 | if let Some(exp) = crate::macros::expand(db, file_id, macro_call) { | 18 | if let Some(exp) = crate::macros::expand(db, file_id, macro_call) { |
19 | let mapped_ranges = ra_editor::highlight(exp.source_file()) | 19 | let mapped_ranges = ra_editor::highlight(exp.source_file().syntax()) |
20 | .into_iter() | 20 | .into_iter() |
21 | .filter_map(|r| { | 21 | .filter_map(|r| { |
22 | let mapped_range = exp.map_range_back(r.range)?; | 22 | let mapped_range = exp.map_range_back(r.range)?; |