Skip to content

Commit f3ceb33

Browse files
committed
Hook up experimental TS refactor error
For microsoft/TypeScript#37871
1 parent be3df0a commit f3ceb33

File tree

1 file changed

+11
-1
lines changed
  • extensions/typescript-language-features/src/features

1 file changed

+11
-1
lines changed

extensions/typescript-language-features/src/features/refactor.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ import FormattingOptionsManager from './fileConfigurationManager';
1919

2020
const localize = nls.loadMessageBundle();
2121

22+
interface RefactorActionInfo extends Proto.RefactorActionInfo {
23+
error?: string
24+
}
2225

2326
class ApplyRefactoringCommand implements Command {
2427
public static readonly ID = '_typescript.applyRefactoring';
@@ -280,13 +283,20 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider {
280283
}
281284

282285
private refactorActionToCodeAction(
283-
action: Proto.RefactorActionInfo,
286+
action: RefactorActionInfo,
284287
document: vscode.TextDocument,
285288
info: Proto.ApplicableRefactorInfo,
286289
rangeOrSelection: vscode.Range | vscode.Selection,
287290
allActions: readonly Proto.RefactorActionInfo[],
288291
) {
289292
const codeAction = new vscode.CodeAction(action.description, TypeScriptRefactorProvider.getKind(action));
293+
294+
// https://github.com/microsoft/TypeScript/pull/37871
295+
if (action.error) {
296+
codeAction.disabled = { reason: action.error };
297+
return codeAction;
298+
}
299+
290300
codeAction.command = {
291301
title: action.description,
292302
command: ApplyRefactoringCommand.ID,

0 commit comments

Comments
 (0)