about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2024-12-31 12:33:51 +0000
committerGitHub <noreply@github.com>2024-12-31 12:33:51 +0000
commit88e630b8592ecc9df82bf568160df2e064df35e5 (patch)
treeafcda5d4e283fc9ae58c278f6e338c990d5a487d
parentfd7ef275f697c85edba6953bc11f619d233083c8 (diff)
parent8860d073f3fa30e6831acac44fb5528abd30a891 (diff)
downloadrust-88e630b8592ecc9df82bf568160df2e064df35e5.tar.gz
rust-88e630b8592ecc9df82bf568160df2e064df35e5.zip
Merge pull request #18802 from roife/fix-18800
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,