Skip to content

Conversation

@dejan-lukic
Copy link
Contributor

The button does not get rendered if there are no missed coverage lines, so we wait for the coverage data to load and the cells to be rendered before attempting a render of the button

Copilot AI review requested due to automatic review settings July 9, 2025 23:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors UI injection to await coverage rendering before adding the “Jump to next uncovered line” button and updates the navigation logic to properly deselect and reselect coverage lines when navigating.

  • Converted tryInjectDiffCommitUI to async and extracted link processing into processFileLinks
  • Added logic in jumpToNextUncoveredLine to deselect the current line before moving and reselect the new line
  • Introduced a selectLinkableLine helper and updated badges/buttons injection timing
Comments suppressed due to low confidence (3)

src/github-injector.ts:180

  • The new deselection and reselection logic in jumpToNextUncoveredLine isn’t covered by tests. Consider adding unit tests to verify that the current line is deselected and the new line is highlighted correctly.
  const currentElement = uncoveredLineDivs[currentlySelectedIndex];

src/github-injector.ts:82

  • The early return checking for qlty-diff-ui was removed, so tryInjectDiffCommitUI may inject badges and buttons multiple times. Consider re-adding a guard like if (rootElement.classList.contains('qlty-diff-ui')) return; at the top.
async function tryInjectDiffCommitUI(): Promise<void> {

src/github-injector.ts:107

  • [nitpick] The rootElement parameter is never used inside processFileLinks. Removing this unused parameter will simplify the function signature.
async function processFileLinks(rootElement: HTMLElement, links: Element[]) {

@dejan-lukic dejan-lukic force-pushed the hotfix/wait-for-gutter-cells-before-rendering-jump-button branch from 0493721 to 08e6d9d Compare July 10, 2025 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant