Skip to content

Commit

Permalink
Rename source.autoFix to source.fixAll
Browse files Browse the repository at this point in the history
Part of #62110

`autoFix` is a confusing term since we have a `auto fix` command now. Using `fix all` as this term is used by many linters for this type of operation
  • Loading branch information
mjbvz committed Jan 22, 2019
1 parent 73dfd92 commit 508f431
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const autoFixableDiagnosticCodes = new Set<number>([
class TypeScriptAutoFixProvider implements vscode.CodeActionProvider {

public static readonly metadata: vscode.CodeActionProviderMetadata = {
providedCodeActionKinds: [vscode.CodeActionKind.SourceAutoFix]
providedCodeActionKinds: [vscode.CodeActionKind.SourceFixAll]
};

constructor(
Expand All @@ -38,7 +38,7 @@ class TypeScriptAutoFixProvider implements vscode.CodeActionProvider {
context: vscode.CodeActionContext,
token: vscode.CancellationToken
): Promise<vscode.CodeAction[] | undefined> {
if (!context.only || !vscode.CodeActionKind.SourceAutoFix.intersects(context.only)) {
if (!context.only || !vscode.CodeActionKind.SourceFixAll.intersects(context.only)) {
return undefined;
}

Expand Down Expand Up @@ -82,7 +82,7 @@ class TypeScriptAutoFixProvider implements vscode.CodeActionProvider {
const { edit, fixedDiagnostics } = autoFixResponse;
const codeAction = new vscode.CodeAction(
localize('autoFix.label', 'Auto fix'),
vscode.CodeActionKind.SourceAutoFix);
vscode.CodeActionKind.SourceFixAll);
codeAction.edit = edit;
codeAction.diagnostics = fixedDiagnostics;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default class LanguageProvider extends Disposable {
this._register((await import('./features/jsDocCompletions')).register(selector, this.client));
this._register((await import('./features/organizeImports')).register(selector, this.client, this.commandManager, this.fileConfigurationManager, this.telemetryReporter));
this._register((await import('./features/quickFix')).register(selector, this.client, this.fileConfigurationManager, this.commandManager, this.client.diagnosticsManager, this.telemetryReporter));
this._register((await import('./features/autoFix')).register(selector, this.client, this.fileConfigurationManager, this.client.diagnosticsManager));
this._register((await import('./features/fixAll')).register(selector, this.client, this.fileConfigurationManager, this.client.diagnosticsManager));
this._register((await import('./features/refactor')).register(selector, this.client, this.fileConfigurationManager, this.commandManager, this.telemetryReporter));
this._register((await import('./features/references')).register(selector, this.client));
this._register((await import('./features/referencesCodeLens')).register(selector, this.description.id, this.client, cachedResponse));
Expand Down
4 changes: 2 additions & 2 deletions src/vs/editor/common/config/commonEditorConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -839,9 +839,9 @@ const editorConfiguration: IConfigurationNode = {
'type': 'boolean',
'description': nls.localize('codeActionsOnSave.organizeImports', "Controls whether organize imports action should be run on file save.")
},
'source.autoFix': {
'source.fixAll': {
'type': 'boolean',
'description': nls.localize('codeActionsOnSave.autoFix', "Controls whether auto fix action should be run on file save.")
'description': nls.localize('codeActionsOnSave.fixAll', "Controls whether auto fix action should be run on file save.")
}
},
'additionalProperties': {
Expand Down
7 changes: 5 additions & 2 deletions src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1134,9 +1134,12 @@ declare module 'vscode' {
//#region Autofix - mjbvz
export namespace CodeActionKind {
/**
* Base kind for an auto fix source action: `source.autoFix`.
* Base kind for an auto fix source action: `source.fixAll`.
*
* Fix all actions automatically fix errors in the code that have a clear fix that does not require user input.
* They should not suppress errors or perform unsafe fixes such as generating new types or classes.
*/
export const SourceAutoFix: CodeActionKind;
export const SourceFixAll: CodeActionKind;
}
//#endregion
}
2 changes: 1 addition & 1 deletion src/vs/workbench/api/node/extHostTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ export class CodeActionKind {
public static readonly RefactorRewrite = CodeActionKind.Refactor.append('rewrite');
public static readonly Source = CodeActionKind.Empty.append('source');
public static readonly SourceOrganizeImports = CodeActionKind.Source.append('organizeImports');
public static readonly SourceAutoFix = CodeActionKind.Source.append('autoFix');
public static readonly SourceFixAll = CodeActionKind.Source.append('fixAll');

constructor(
public readonly value: string
Expand Down

0 comments on commit 508f431

Please sign in to comment.