mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Code correctly treats empty config as default-false
This commit is contained in:
parent
6c154dd347
commit
1e7d82c778
|
@ -335,19 +335,19 @@ class TypeScriptQuickFixProvider implements vscode.CodeActionProvider<VsCodeCode
|
|||
let message: string | undefined;
|
||||
let expand: Expand | undefined;
|
||||
|
||||
if (action.fixName === fixNames.classIncorrectlyImplementsInterface && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.classIncorrectlyImplementsInterface') !== false) {
|
||||
if (action.fixName === fixNames.classIncorrectlyImplementsInterface && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.classIncorrectlyImplementsInterface')) {
|
||||
message = `Implement the stubbed-out class members for ${document.getText(diagnostic.range)} with a useful implementation.`;
|
||||
expand = { kind: 'code-action', action };
|
||||
}
|
||||
else if (action.fixName === fixNames.fixClassDoesntImplementInheritedAbstractMember && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.classDoesntImplementInheritedAbstractMember') !== false) {
|
||||
else if (action.fixName === fixNames.fixClassDoesntImplementInheritedAbstractMember && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.classDoesntImplementInheritedAbstractMember')) {
|
||||
message = `Implement the stubbed-out class members for ${document.getText(diagnostic.range)} with a useful implementation.`;
|
||||
expand = { kind: 'code-action', action };
|
||||
}
|
||||
else if (action.fixName === fixNames.fixMissingFunctionDeclaration && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.missingFunctionDeclaration') !== false) {
|
||||
else if (action.fixName === fixNames.fixMissingFunctionDeclaration && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.missingFunctionDeclaration')) {
|
||||
message = `Provide a reasonable implementation of the function ${document.getText(diagnostic.range)} given its type and the context it's called in.`;
|
||||
expand = { kind: 'code-action', action };
|
||||
}
|
||||
else if (action.fixName === fixNames.inferFromUsage && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.inferAndAddTypes') !== false) {
|
||||
else if (action.fixName === fixNames.inferFromUsage && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.inferAndAddTypes')) {
|
||||
const inferFromBody = new VsCodeCodeAction(action, 'Copilot: Infer and add types', vscode.CodeActionKind.QuickFix);
|
||||
inferFromBody.edit = new vscode.WorkspaceEdit();
|
||||
inferFromBody.diagnostics = [diagnostic];
|
||||
|
@ -362,7 +362,7 @@ class TypeScriptQuickFixProvider implements vscode.CodeActionProvider<VsCodeCode
|
|||
};
|
||||
actions.push(inferFromBody);
|
||||
}
|
||||
else if (action.fixName === fixNames.addNameToNamelessParameter && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.addNameToNamelessParameter') !== false) {
|
||||
else if (action.fixName === fixNames.addNameToNamelessParameter && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.addNameToNamelessParameter')) {
|
||||
const newText = action.changes.map(change => change.textChanges.map(textChange => textChange.newText).join('')).join('');
|
||||
message = `Rename the parameter ${newText} with a more meaningful name.`;
|
||||
expand = {
|
||||
|
|
|
@ -578,10 +578,10 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider<TsCodeActi
|
|||
} else {
|
||||
let copilotRename: ((info: Proto.RefactorEditInfo) => vscode.Command) | undefined;
|
||||
if (vscode.workspace.getConfiguration('typescript', null).get('experimental.aiCodeActions')) {
|
||||
if (Extract_Constant.matches(action) && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.extractConstant') !== false
|
||||
|| Extract_Function.matches(action) && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.extractFunction') !== false
|
||||
|| Extract_Type.matches(action) && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.extractType') !== false
|
||||
|| Extract_Interface.matches(action) && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.extractInterface') !== false) {
|
||||
if (Extract_Constant.matches(action) && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.extractConstant')
|
||||
|| Extract_Function.matches(action) && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.extractFunction')
|
||||
|| Extract_Type.matches(action) && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.extractType')
|
||||
|| Extract_Interface.matches(action) && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.extractInterface')) {
|
||||
const newName = Extract_Constant.matches(action) ? 'newLocal'
|
||||
: Extract_Function.matches(action) ? 'newFunction'
|
||||
: Extract_Type.matches(action) ? 'NewType'
|
||||
|
|
Loading…
Reference in a new issue