aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/macros.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-12-28 18:35:52 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-12-28 18:35:52 +0000
commit751616f062b07f5dee2921f69886bd1a5b1234aa (patch)
tree616bcd980ac69eb5070c1e7a6d90ebee71cb7348 /crates/ra_analysis/src/macros.rs
parent10e687f281e4850ae258d5dae84dee871e24e8ed (diff)
parent792899587647f5aa0293c2588173677682187c0a (diff)
Merge #352
352: Macro extend selection r=matklad a=matklad and a bunch of unrelated stuff Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_analysis/src/macros.rs')
-rw-r--r--crates/ra_analysis/src/macros.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/ra_analysis/src/macros.rs b/crates/ra_analysis/src/macros.rs
index c0dd49dc8..b9feb7fad 100644
--- a/crates/ra_analysis/src/macros.rs
+++ b/crates/ra_analysis/src/macros.rs
@@ -61,4 +61,15 @@ impl MacroExpansion {
61 } 61 }
62 None 62 None
63 } 63 }
64 pub(crate) fn map_range_forward(&self, src_range: TextRange) -> Option<TextRange> {
65 for (s_range, t_range) in self.ranges_map.iter() {
66 if src_range.is_subrange(&s_range) {
67 let src_at_zero_range = src_range - src_range.start();
68 let src_range_offset = src_range.start() - s_range.start();
69 let src_range = src_at_zero_range + src_range_offset + t_range.start();
70 return Some(src_range);
71 }
72 }
73 None
74 }
64} 75}