diff options
author | Aleksey Kladov <[email protected]> | 2018-12-28 17:33:39 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-12-28 17:33:39 +0000 |
commit | 5299a35e3dc484ea2e7d42cfeed89aee806425d3 (patch) | |
tree | 87a7ef3976e50ef120246a777da0593823f15d9d /crates/ra_analysis/src/macros.rs | |
parent | 10e687f281e4850ae258d5dae84dee871e24e8ed (diff) |
extend selection works with macros
Diffstat (limited to 'crates/ra_analysis/src/macros.rs')
-rw-r--r-- | crates/ra_analysis/src/macros.rs | 11 |
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 | } |