Updated mapping data structure

This commit is contained in:
2026-06-15 14:49:44 +02:00
parent 44f10d3fb7
commit 663dab52ec
5 changed files with 81 additions and 63 deletions
+23 -22
View File
@@ -57,29 +57,30 @@ impl Backend {
match self.mapping.lock().await.get(&rs_path) {
Some(mapping) => {
rs_loc
// FIX: Match the find_mapping operation instead of calling .expect("Failed to map")
match rev_mapper::find_mapping(
mapping,
&rev_mapper::RustMap(
rs_loc.range.start.line as usize,
rs_loc.range.start.character as usize,
),
) {
Some((_, rev_mapper::MistMap(line, character))) => Location {
uri: Url::from_file_path(from_rust_to_mist(rs_path)).unwrap(),
range: Range {
start: Position {
line: line as u32 - 1,
character: character as u32,
},
end: Position {
line: line as u32 - 1,
character: character as u32 + 1,
},
},
},
None => rs_loc,
}
// match rev_mapper::find_mapping(
// mapping,
// &rev_mapper::RustMap(
// rs_loc.range.start.line as usize,
// rs_loc.range.start.character as usize,
// ),
// ) {
// Some((_, rev_mapper::MistMap(line, character))) => Location {
// uri: Url::from_file_path(from_rust_to_mist(rs_path)).unwrap(),
// range: Range {
// start: Position {
// line: line as u32 - 1,
// character: character as u32,
// },
// end: Position {
// line: line as u32 - 1,
// character: character as u32 + 1,
// },
// },
// },
// None => rs_loc,
// }
}
None => rs_loc,
}