Determine the navigation target based on the resolved symbols.
(
kind: SymbolNavigationKind,
resolved_left: Option<ResolvedSymbol>,
resolved_right: Option<ResolvedSymbol>,
)
| 429 | |
| 430 | /// Determine the navigation target based on the resolved symbols. |
| 431 | fn resolve_navigation( |
| 432 | kind: SymbolNavigationKind, |
| 433 | resolved_left: Option<ResolvedSymbol>, |
| 434 | resolved_right: Option<ResolvedSymbol>, |
| 435 | ) -> ResolvedNavigation { |
| 436 | match (resolved_left, resolved_right) { |
| 437 | (Some(left), Some(right)) => match (left.section.kind, right.section.kind) { |
| 438 | (SectionKind::Code, SectionKind::Code) => ResolvedNavigation { |
| 439 | view: match kind { |
| 440 | SymbolNavigationKind::Normal => View::FunctionDiff, |
| 441 | SymbolNavigationKind::Extab => View::ExtabDiff, |
| 442 | }, |
| 443 | left_symbol: Some(left.symbol_ref), |
| 444 | right_symbol: Some(right.symbol_ref), |
| 445 | }, |
| 446 | (SectionKind::Data, SectionKind::Data) => ResolvedNavigation { |
| 447 | view: View::DataDiff, |
| 448 | left_symbol: Some(left.symbol_ref), |
| 449 | right_symbol: Some(right.symbol_ref), |
| 450 | }, |
| 451 | _ => ResolvedNavigation::default(), |
| 452 | }, |
| 453 | (Some(left), None) => match left.section.kind { |
| 454 | SectionKind::Code => ResolvedNavigation { |
| 455 | view: match kind { |
| 456 | SymbolNavigationKind::Normal => View::FunctionDiff, |
| 457 | SymbolNavigationKind::Extab => View::ExtabDiff, |
| 458 | }, |
| 459 | left_symbol: Some(left.symbol_ref), |
| 460 | right_symbol: None, |
| 461 | }, |
| 462 | SectionKind::Data => ResolvedNavigation { |
| 463 | view: View::DataDiff, |
| 464 | left_symbol: Some(left.symbol_ref), |
| 465 | right_symbol: None, |
| 466 | }, |
| 467 | _ => ResolvedNavigation::default(), |
| 468 | }, |
| 469 | (None, Some(right)) => match right.section.kind { |
| 470 | SectionKind::Code => ResolvedNavigation { |
| 471 | view: match kind { |
| 472 | SymbolNavigationKind::Normal => View::FunctionDiff, |
| 473 | SymbolNavigationKind::Extab => View::ExtabDiff, |
| 474 | }, |
| 475 | left_symbol: None, |
| 476 | right_symbol: Some(right.symbol_ref), |
| 477 | }, |
| 478 | SectionKind::Data => ResolvedNavigation { |
| 479 | view: View::DataDiff, |
| 480 | left_symbol: None, |
| 481 | right_symbol: Some(right.symbol_ref), |
| 482 | }, |
| 483 | _ => ResolvedNavigation::default(), |
| 484 | }, |
| 485 | (None, None) => ResolvedNavigation::default(), |
| 486 | } |
| 487 | } |
| 488 |