Skip to content

Conversation

danparizher
Copy link
Contributor

Summary

Fixes #19655

  • Switched quick-fix filtering from line-equality to proper range intersection to show all relevant fixes for the hovered range.
  • Set code on markers with diagnostic.code ?? undefined to satisfy Monaco’s IMarkerData type and ensure the rule code shows up without type errors.

Comment on lines 140 to 167
const isBeforeOrEqual = (
lineA: number,
colA: number,
lineB: number,
colB: number,
) => lineA < lineB || (lineA === lineB && colA <= colB);

const isAfterOrEqual = (
lineA: number,
colA: number,
lineB: number,
colB: number,
) => lineA > lineB || (lineA === lineB && colA >= colB);

// Ranges [diagStart, diagEnd] and [rangeStart, rangeEnd] intersect if:
// diagStart <= rangeEnd AND diagEnd >= rangeStart
const diagStartsBeforeOrAtRangeEnd = isBeforeOrEqual(
diagStartLine,
diagStartCol,
rangeEndLine,
rangeEndCol,
);
const diagEndsAfterOrAtRangeStart = isAfterOrEqual(
diagEndLine,
diagEndCol,
rangeStartLine,
rangeStartCol,
);
Copy link
Member

Choose a reason for hiding this comment

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

Can we use range.containsRange(other_range) here instead (or the other way round or any other range method)

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Thank you. This makes sense to me, but I'm wondering if there's any Range method that we could use instead of rolling our own "intersects" implementation

@MichaReiser MichaReiser added the playground A playground-specific issue label Sep 23, 2025
@danparizher
Copy link
Contributor Author

I did some digging and found Range.areIntersecting() which is perfect for this case.

@MichaReiser MichaReiser merged commit 2c91656 into astral-sh:main Sep 23, 2025
35 checks passed
@danparizher danparizher deleted the fix-19655 branch September 23, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
playground A playground-specific issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ISC002 makes W605 unfixable on playground
2 participants