Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
WalkthroughThe PR adds user-facing toast notifications when navigation targets are clamped to file boundaries. When a link targets positions outside file extent, users now see warning toasts indicating what clamped (line, column, or both) instead of silent clamping. Exact navigation shows an info toast with the target range. Changes
Sequence DiagramsequenceDiagram
actor User
participant Handler as RangeLinkNavigationHandler
participant Converter as Position Converter
participant Formatter as formatClampingSummary
participant i18n as Localization
participant Adapter as VS Code Adapter
User->>Handler: navigateToLink(range)
Handler->>Converter: Convert & clamp to bounds
Converter-->>Handler: ConvertedPosition (with clamp flags)
alt Any clamping detected
Handler->>Formatter: formatClampingSummary(start, end)
Formatter->>i18n: formatMessage(CLAMPED_SUMMARY_*)
i18n-->>Formatter: Localized summary text
Formatter-->>Handler: "line exceeded file length"
Handler->>Adapter: showWarningMessage("RangeLink: Navigated to ... (clamped: ...)")
Adapter-->>User: ⚠️ Warning toast
else Exact navigation (no clamping)
Handler->>i18n: formatMessage(INFO_NAVIGATION_SUCCESS)
i18n-->>Handler: Localized position string
Handler->>Adapter: showInformationMessage("RangeLink: Navigated to ... @ L-C")
Adapter-->>User: ℹ️ Info toast
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The PR introduces new navigation feedback when links point beyond file boundaries, including warning messages and information toasts. This requires new test cases to verify the correct behavior of these notifications. Suggested test cases:
Generated by QA Gap Check (GPT-4o-mini via GitHub Models) |
…utility
Phase 2 needs to show different toasts for exact vs clamped navigation. This adds the infrastructure: a new warning message code with a template that includes clamping details, and a pure utility that aggregates per-position clamping flags into a user-readable summary ("line exceeded file length", "column exceeded line length", or "line and column exceeded bounds").
…ions Tests cover single-axis (line or character on start or end), multi-axis (both axes, split across positions), and the UNEXPECTED_CODE_PATH throw when called with no clamping flags.
Previously, navigation always showed the same info toast regardless of whether positions were silently adjusted. Now the handler checks the clamping flags from Phase 1 and shows a warning toast with a human-readable summary when any clamping occurred, preserving the info toast for exact navigation.
Existing clamping tests now also assert the correct toast type: warning toast with clamping summary when positions are clamped, info toast when navigation is exact. Verifies both directions — that the wrong toast type is NOT called.
Summary
Replaces the single "navigated to" info toast with context-aware feedback based on clamping status from Phase 1. When a RangeLink points beyond file boundaries and positions are silently adjusted, users now see a warning toast with a human-readable explanation of what was clamped. Exact navigation continues to show the existing info toast.
Changes
WARN_NAVIGATION_CLAMPEDmessage code with localized template including{clampingSummary}parameterformatClampingSummaryutility that aggregates per-position clamping flags into localized descriptions ("line exceeded file length", "column exceeded line length", "line and column exceeded bounds")MessageCode+messages.en.ts+formatMessage)formatClampingSummarywith no clamping flags throwsUNEXPECTED_CODE_PATHrather than silently returning a nonsensical valueanyClampingflag computed in Phase 1Test Plan
formatClampingSummarycovering: line-only, character-only, both, cross-position aggregation, and UNEXPECTED_CODE_PATH throwRangeLinkNavigationHandler.test.tsupdated to verify toast type (warning vs info) and exact message contentRelated
Summary by CodeRabbit