From 57030f587bb0bbe4dea9a97016b4e0f49a7ef5f3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 31 Dec 2018 19:19:50 +0300 Subject: use macros database in analysis --- crates/ra_analysis/src/extend_selection.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_analysis/src/extend_selection.rs') diff --git a/crates/ra_analysis/src/extend_selection.rs b/crates/ra_analysis/src/extend_selection.rs index 805e9059e..62133ef29 100644 --- a/crates/ra_analysis/src/extend_selection.rs +++ b/crates/ra_analysis/src/extend_selection.rs @@ -23,10 +23,10 @@ fn extend_selection_in_macro( frange: FileRange, ) -> Option { let macro_call = find_macro_call(source_file.syntax(), frange.range)?; - let exp = crate::macros::expand(db, frange.file_id, macro_call)?; - let dst_range = exp.map_range_forward(frange.range)?; - let dst_range = ra_editor::extend_selection(exp.source_file().syntax(), dst_range)?; - let src_range = exp.map_range_back(dst_range)?; + let (off, exp) = crate::macros::expand(db, frange.file_id, macro_call)?; + let dst_range = exp.map_range_forward(frange.range - off)?; + let dst_range = ra_editor::extend_selection(exp.syntax().borrowed(), dst_range)?; + let src_range = exp.map_range_back(dst_range)? + off; Some(src_range) } -- cgit v1.2.3