-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[playground
] Allow hover quick fixes to appear for overlapping diagnostics
#20527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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, | ||
); |
There was a problem hiding this comment.
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)
There was a problem hiding this 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
I did some digging and found |
Summary
Fixes #19655
code
on markers withdiagnostic.code ?? undefined
to satisfy Monaco’sIMarkerData
type and ensure the rule code shows up without type errors.