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> {
|
): languages.ProviderResult<languages.CodeActionList> {
|
||||||
const actions = this.diagnostics
|
const actions = this.diagnostics
|
||||||
// Show fixes for any diagnostic whose range intersects the requested range
|
// Show fixes for any diagnostic whose range intersects the requested range
|
||||||
.filter((check) =>
|
.filter((check) => {
|
||||||
Range.areIntersecting(
|
const diagnosticRange = new Range(
|
||||||
new Range(
|
check.start_location.row,
|
||||||
check.start_location.row,
|
check.start_location.column,
|
||||||
check.start_location.column,
|
check.end_location.row,
|
||||||
check.end_location.row,
|
check.end_location.column,
|
||||||
check.end_location.column,
|
);
|
||||||
),
|
|
||||||
range,
|
return Range.areIntersectingOrTouching(diagnosticRange, range);
|
||||||
),
|
})
|
||||||
)
|
|
||||||
.filter(({ fix }) => fix)
|
.filter(({ fix }) => fix)
|
||||||
.map((check) => ({
|
.map((check) => ({
|
||||||
title: check.fix
|
title: check.fix
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue