[`playground`] Fix quick fixes for empty ranges in playground (#20599)

Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
Dan Parizher 2025-09-29 03:38:32 -04:00 committed by GitHub
parent e5faf6c268
commit 053c750c93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 11 deletions

View File

@ -125,17 +125,16 @@ class RuffCodeActionProvider implements CodeActionProvider {
): languages.ProviderResult<languages.CodeActionList> {
const actions = this.diagnostics
// Show fixes for any diagnostic whose range intersects the requested range
.filter((check) =>
Range.areIntersecting(
new Range(
check.start_location.row,
check.start_location.column,
check.end_location.row,
check.end_location.column,
),
range,
),
)
.filter((check) => {
const diagnosticRange = new Range(
check.start_location.row,
check.start_location.column,
check.end_location.row,
check.end_location.column,
);
return Range.areIntersectingOrTouching(diagnosticRange, range);
})
.filter(({ fix }) => fix)
.map((check) => ({
title: check.fix