diff --git a/extensions/typescript-language-features/src/features/refactor.ts b/extensions/typescript-language-features/src/features/refactor.ts index a6ed687fbc2..3ccb5969913 100644 --- a/extensions/typescript-language-features/src/features/refactor.ts +++ b/extensions/typescript-language-features/src/features/refactor.ts @@ -314,7 +314,9 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { private appendInvalidActions(actions: vscode.CodeAction[]): vscode.CodeAction[] { if (!actions.some(action => action.kind && Extract_Constant.kind.contains(action.kind))) { const disabledAction = new vscode.CodeAction('Extract to constant', Extract_Constant.kind); - disabledAction.disabled = localize('extract.disabled', "The current selection cannot be extracted"); + disabledAction.disabled = { + reason: localize('extract.disabled', "The current selection cannot be extracted"), + }; disabledAction.isPreferred = true; actions.push(disabledAction); } diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 09a9d256f0f..36683346748 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1331,10 +1331,16 @@ declare module 'vscode' { /** * Marks that the code action cannot currently be applied. * - * This should be a human readable description of why the code action is currently disabled. Disabled code actions - * will be surfaced in the refactor UI but cannot be applied. + * Disabled code actions will be surfaced in the refactor UI but cannot be applied. */ - disabled?: string; + disabled?: { + /** + * Human readable description of why the code action is currently disabled. + * + * This is displayed in the UI. + */ + reason: string; + }; } //#endregion diff --git a/src/vs/workbench/api/common/extHostLanguageFeatures.ts b/src/vs/workbench/api/common/extHostLanguageFeatures.ts index bd569e64b04..a9482c1616c 100644 --- a/src/vs/workbench/api/common/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/common/extHostLanguageFeatures.ts @@ -389,7 +389,7 @@ class CodeActionAdapter { edit: candidate.edit && typeConvert.WorkspaceEdit.from(candidate.edit), kind: candidate.kind && candidate.kind.value, isPreferred: candidate.isPreferred, - disabled: candidate.disabled + disabled: candidate.disabled?.reason }); } }