Skip to content

Commit 04e3869

Browse files
committed
refactor: Reuse the from_proto call in handle_hover
1 parent 5b30d9c commit 04e3869

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

crates/rust-analyzer/src/handlers.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -873,8 +873,6 @@ pub(crate) fn handle_hover(
873873
params: lsp_ext::HoverParams,
874874
) -> Result<Option<lsp_ext::Hover>> {
875875
let _p = profile::span("handle_hover");
876-
let file_id = from_proto::file_id(&snap, &params.text_document.uri)?;
877-
878876
let range = match params.position {
879877
PositionOrRange::Position(position) => Range::new(position, position),
880878
PositionOrRange::Range(range) => range,
@@ -886,7 +884,7 @@ pub(crate) fn handle_hover(
886884
Some(info) => info,
887885
};
888886

889-
let line_index = snap.file_line_index(file_id)?;
887+
let line_index = snap.file_line_index(file_range.file_id)?;
890888
let range = to_proto::range(&line_index, info.range);
891889
let hover = lsp_ext::Hover {
892890
hover: lsp_types::Hover {

0 commit comments

Comments
 (0)