mirror of https://github.com/astral-sh/ruff
[`playground`] Fix quick fixes for empty ranges in playground (#20599)
Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
parent
e5faf6c268
commit
053c750c93
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue