From 2e5c2edd9e400676d66048981a00dfdfe3b20b1b Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 5 Dec 2023 15:49:50 -0800 Subject: [PATCH 1/2] reverting changes to allow code actions on empty lines --- src/vs/editor/contrib/codeAction/common/types.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/vs/editor/contrib/codeAction/common/types.ts b/src/vs/editor/contrib/codeAction/common/types.ts index 4f0d8e0f17156..f0f753f38d6b6 100644 --- a/src/vs/editor/contrib/codeAction/common/types.ts +++ b/src/vs/editor/contrib/codeAction/common/types.ts @@ -127,11 +127,6 @@ export function filtersAction(filter: CodeActionFilter, action: languages.CodeAc } } - // On empty lines and selections, show only code AI code actions - if (rangeOrSelection.isEmpty() && model.getLineContent(rangeOrSelection.startLineNumber).length === 0) { - return !!action.isAI; - } - return true; } From 249b265379a764a9d15c05faa62b9a47d853bef7 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Wed, 6 Dec 2023 11:08:28 +0100 Subject: [PATCH 2/2] remove unused parameters --- src/vs/editor/contrib/codeAction/browser/codeAction.ts | 2 +- src/vs/editor/contrib/codeAction/common/types.ts | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/vs/editor/contrib/codeAction/browser/codeAction.ts b/src/vs/editor/contrib/codeAction/browser/codeAction.ts index fc5b2cb033c91..050639f1a4538 100644 --- a/src/vs/editor/contrib/codeAction/browser/codeAction.ts +++ b/src/vs/editor/contrib/codeAction/browser/codeAction.ts @@ -130,7 +130,7 @@ export async function getCodeActions( return emptyCodeActionsResponse; } - const filteredActions = (providedCodeActions?.actions || []).filter(action => action && filtersAction(filter, action, model, rangeOrSelection)); + const filteredActions = (providedCodeActions?.actions || []).filter(action => action && filtersAction(filter, action)); const documentation = getDocumentationFromProvider(provider, filteredActions, filter.include); return { actions: filteredActions.map(action => new CodeActionItem(action, provider)), diff --git a/src/vs/editor/contrib/codeAction/common/types.ts b/src/vs/editor/contrib/codeAction/common/types.ts index f0f753f38d6b6..19a690e23dceb 100644 --- a/src/vs/editor/contrib/codeAction/common/types.ts +++ b/src/vs/editor/contrib/codeAction/common/types.ts @@ -7,10 +7,7 @@ import { CancellationToken } from 'vs/base/common/cancellation'; import { onUnexpectedExternalError } from 'vs/base/common/errors'; import { Position } from 'vs/editor/common/core/position'; import * as languages from 'vs/editor/common/languages'; -import { ITextModel } from 'vs/editor/common/model'; import { ActionSet } from 'vs/platform/actionWidget/common/actionWidget'; -import { Range } from 'vs/editor/common/core/range'; -import { Selection } from 'vs/editor/common/core/selection'; export class CodeActionKind { private static readonly sep = '.'; @@ -98,7 +95,7 @@ export function mayIncludeActionsOfKind(filter: CodeActionFilter, providedKind: return true; } -export function filtersAction(filter: CodeActionFilter, action: languages.CodeAction, model: ITextModel, rangeOrSelection: Range | Selection): boolean { +export function filtersAction(filter: CodeActionFilter, action: languages.CodeAction): boolean { const actionKind = action.kind ? new CodeActionKind(action.kind) : undefined; // Filter out actions by kind