From 5ff2c43e0ed8cd71e753862ced7c5e0f702ec9b1 Mon Sep 17 00:00:00 2001 From: Dan Date: Sat, 27 Sep 2025 00:43:46 -0400 Subject: [PATCH 1/2] fix-20594 --- playground/ruff/src/Editor/SourceEditor.tsx | 26 ++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/playground/ruff/src/Editor/SourceEditor.tsx b/playground/ruff/src/Editor/SourceEditor.tsx index eb39a8c063b54..70229d522bcbd 100644 --- a/playground/ruff/src/Editor/SourceEditor.tsx +++ b/playground/ruff/src/Editor/SourceEditor.tsx @@ -125,17 +125,21 @@ class RuffCodeActionProvider implements CodeActionProvider { ): languages.ProviderResult { 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, + ); + + // Handle empty ranges specially - they should be available when the cursor is at the exact position + if (diagnosticRange.isEmpty()) { + return range.containsPosition(diagnosticRange.getStartPosition()); + } + + return Range.areIntersecting(diagnosticRange, range); + }) .filter(({ fix }) => fix) .map((check) => ({ title: check.fix From 156f27be55c89445434304cc757e1b84a919ab70 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Mon, 29 Sep 2025 09:34:25 +0200 Subject: [PATCH 2/2] Simplify --- playground/ruff/src/Editor/SourceEditor.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/playground/ruff/src/Editor/SourceEditor.tsx b/playground/ruff/src/Editor/SourceEditor.tsx index 70229d522bcbd..1dd8b20a64193 100644 --- a/playground/ruff/src/Editor/SourceEditor.tsx +++ b/playground/ruff/src/Editor/SourceEditor.tsx @@ -133,12 +133,7 @@ class RuffCodeActionProvider implements CodeActionProvider { check.end_location.column, ); - // Handle empty ranges specially - they should be available when the cursor is at the exact position - if (diagnosticRange.isEmpty()) { - return range.containsPosition(diagnosticRange.getStartPosition()); - } - - return Range.areIntersecting(diagnosticRange, range); + return Range.areIntersectingOrTouching(diagnosticRange, range); }) .filter(({ fix }) => fix) .map((check) => ({