Skip to content

fix(chrome-ext): shifting highlights after cursor during delay#3446

Merged
elijah-potter merged 2 commits into
masterfrom
feature/fix-delay
May 26, 2026
Merged

fix(chrome-ext): shifting highlights after cursor during delay#3446
elijah-potter merged 2 commits into
masterfrom
feature/fix-delay

Conversation

@elijah-potter
Copy link
Copy Markdown
Collaborator

@elijah-potter elijah-potter commented May 20, 2026

Issues

N/A

Description

This PR fixes stale Chrome Extension highlight positions when lint delay/debounce is enabled and the user edits text before an existing lint.

This issue was brought to my attention by @JasonTheAdams.

The core change adds centralized text-edit span remapping in lint-framework. During render, stale lint spans are remapped from the lint's original source text to the target's current text. Lints that overlap the edit, or no longer point at the same problem text after remapping, are hidden until the next lint pass.

Changes include:

  • Added packages/lint-framework/src/lint/spanMapping.ts for single-edit detection and lint/span remapping.
  • Updated packages/lint-framework/src/lint/LintFramework.ts to remap stale lints during render before computing highlight boxes.
  • Centralized target text extraction in LintFramework so linting and render-time remapping use the same target text model.
  • Added textarea regression coverage for delayed linting behavior.

Demo

N/A

How Has This Been Tested?

Added Playwright coverage for textarea highlights during lint delay:

  • Typing before an existing lint keeps the highlight aligned with the same problem text
  • Editing inside an existing lint hides the stale highlight until fresh lint results arrive

AI Disclosure

  • I am a human and didn't use any AI.
  • I used LLM features of my editor, but not an agent.
  • I used an AI agent interactively.
  • I am an agent or I got an agent to do the work autonomously.

Checklist

  • I have performed a self-review of my own code
  • I have added tests to cover my changes
  • I have considered splitting this into smaller pull requests.

@JasonTheAdams
Copy link
Copy Markdown
Member

Appreciate it! 😄

@elijah-potter elijah-potter added this pull request to the merge queue May 26, 2026
Merged via the queue into master with commit 38fb84a May 26, 2026
13 checks passed
@elijah-potter elijah-potter deleted the feature/fix-delay branch May 26, 2026 19:33
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.

2 participants