about summary refs log tree commit diff
diff options
context:
space:
mode:
authorroife <roifewu@gmail.com>2024-12-31 14:04:12 +0800
committerroife <roifewu@gmail.com>2024-12-31 20:10:22 +0800
commit8860d073f3fa30e6831acac44fb5528abd30a891 (patch)
treefa017faee91886cd60df928ea3ac02891a4e037d
parent65bf7f790b7427fee291f1aa0e69e5c7c2d5ecd2 (diff)
downloadrust-8860d073f3fa30e6831acac44fb5528abd30a891.tar.gz
rust-8860d073f3fa30e6831acac44fb5528abd30a891.zip
fix: incorrect file_id used for ranges in outgoing calls
-rw-r--r--src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs
index d2ed43e882f..f103f6cbe27 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs
@@ -1826,6 +1826,7 @@ pub(crate) fn handle_call_hierarchy_outgoing(
     let doc = TextDocumentIdentifier::new(item.uri);
     let frange = from_proto::file_range(&snap, &doc, item.selection_range)?;
     let fpos = FilePosition { file_id: frange.file_id, offset: frange.range.start() };
+    let line_index = snap.file_line_index(fpos.file_id)?;
 
     let config = snap.config.call_hierarchy();
     let call_items = match snap.analysis.outgoing_calls(config, fpos)? {
@@ -1836,8 +1837,6 @@ pub(crate) fn handle_call_hierarchy_outgoing(
     let mut res = vec![];
 
     for call_item in call_items.into_iter() {
-        let file_id = call_item.target.file_id;
-        let line_index = snap.file_line_index(file_id)?;
         let item = to_proto::call_hierarchy_item(&snap, call_item.target)?;
         res.push(CallHierarchyOutgoingCall {
             to: item,