aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/syntax_highlighting.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-02-08 11:49:43 +0000
committerAleksey Kladov <[email protected]>2019-02-08 11:49:43 +0000
commit12e3b4c70b5ef23b2fdfc197296d483680e125f9 (patch)
tree71baa0e0a62f9f6b61450501c5f821f67badf9e4 /crates/ra_ide_api/src/syntax_highlighting.rs
parent5cb1d41a30d25cbe136402644bf5434dd667f1e5 (diff)
reformat the world
Diffstat (limited to 'crates/ra_ide_api/src/syntax_highlighting.rs')
-rw-r--r--crates/ra_ide_api/src/syntax_highlighting.rs16
1 files changed, 4 insertions, 12 deletions
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs
index 6c4391e1e..a435fe56e 100644
--- a/crates/ra_ide_api/src/syntax_highlighting.rs
+++ b/crates/ra_ide_api/src/syntax_highlighting.rs
@@ -9,20 +9,12 @@ use crate::{
9pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRange> { 9pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRange> {
10 let source_file = db.parse(file_id); 10 let source_file = db.parse(file_id);
11 let mut res = ra_ide_api_light::highlight(source_file.syntax()); 11 let mut res = ra_ide_api_light::highlight(source_file.syntax());
12 for macro_call in source_file 12 for macro_call in source_file.syntax().descendants().filter_map(ast::MacroCall::cast) {
13 .syntax()
14 .descendants()
15 .filter_map(ast::MacroCall::cast)
16 {
17 if let Some((off, exp)) = hir::MacroDef::ast_expand(macro_call) { 13 if let Some((off, exp)) = hir::MacroDef::ast_expand(macro_call) {
18 let mapped_ranges = ra_ide_api_light::highlight(&exp.syntax()) 14 let mapped_ranges =
19 .into_iter() 15 ra_ide_api_light::highlight(&exp.syntax()).into_iter().filter_map(|r| {
20 .filter_map(|r| {
21 let mapped_range = exp.map_range_back(r.range)?; 16 let mapped_range = exp.map_range_back(r.range)?;
22 let res = HighlightedRange { 17 let res = HighlightedRange { range: mapped_range + off, tag: r.tag };
23 range: mapped_range + off,
24 tag: r.tag,
25 };
26 Some(res) 18 Some(res)
27 }); 19 });
28 res.extend(mapped_ranges); 20 res.extend(mapped_ranges);