Skip to content

Commit

Permalink
Merge pull request #200098 from microsoft/justin/code-provider-1.85
Browse files Browse the repository at this point in the history
Revert: Allow non-AI actions on empty lines (for 1.85)
  • Loading branch information
ulugbekna authored Dec 6, 2023
2 parents a3c53e1 + 249b265 commit af28b32
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/vs/editor/contrib/codeAction/browser/codeAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
10 changes: 1 addition & 9 deletions src/vs/editor/contrib/codeAction/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '.';
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -127,11 +124,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;
}

Expand Down

0 comments on commit af28b32

Please sign in to comment.