diff --git a/src/commands/add-selection-to-find-match.ts b/src/commands/add-selection-to-find-match.ts index 612c9e0e62..640e4b0938 100644 --- a/src/commands/add-selection-to-find-match.ts +++ b/src/commands/add-selection-to-find-match.ts @@ -5,7 +5,7 @@ import { EmacsCommand } from "."; export class AddSelectionToNextFindMatch extends EmacsCommand { public readonly id = "addSelectionToNextFindMatch"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { this.emacsController.enterMarkMode(false); return vscode.commands.executeCommand("editor.action.addSelectionToNextFindMatch"); } @@ -14,7 +14,7 @@ export class AddSelectionToNextFindMatch extends EmacsCommand { export class AddSelectionToPreviousFindMatch extends EmacsCommand { public readonly id = "addSelectionToPreviousFindMatch"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { this.emacsController.enterMarkMode(false); return vscode.commands.executeCommand("editor.action.addSelectionToPreviousFindMatch"); } diff --git a/src/commands/case.ts b/src/commands/case.ts index 7e4bc203e7..63c1861f3e 100644 --- a/src/commands/case.ts +++ b/src/commands/case.ts @@ -9,11 +9,7 @@ function hasNonEmptySelection(textEditor: TextEditor): boolean { export class TransformToUppercase extends EmacsCommand { public readonly id = "transformToUppercase"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { if (!hasNonEmptySelection(textEditor)) { await this.emacsController.runCommand("forwardWord"); } @@ -24,11 +20,7 @@ export class TransformToUppercase extends EmacsCommand { export class TransformToLowercase extends EmacsCommand { public readonly id = "transformToLowercase"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { if (!hasNonEmptySelection(textEditor)) { await this.emacsController.runCommand("forwardWord"); } @@ -39,11 +31,7 @@ export class TransformToLowercase extends EmacsCommand { export class TransformToTitlecase extends EmacsCommand { public readonly id = "transformToTitlecase"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { if (!hasNonEmptySelection(textEditor)) { await this.emacsController.runCommand("forwardWord"); } diff --git a/src/commands/delete-blank-lines.ts b/src/commands/delete-blank-lines.ts index 24ea7ffb35..0e8b905b4d 100644 --- a/src/commands/delete-blank-lines.ts +++ b/src/commands/delete-blank-lines.ts @@ -5,11 +5,7 @@ import { EmacsCommand } from "."; export class DeleteBlankLines extends EmacsCommand { public readonly id = "deleteBlankLines"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { const document = textEditor.document; for (let iSel = 0; iSel < textEditor.selections.length; ++iSel) { diff --git a/src/commands/edit.ts b/src/commands/edit.ts index b5d7312bfa..abba3ad0c5 100644 --- a/src/commands/edit.ts +++ b/src/commands/edit.ts @@ -7,7 +7,7 @@ import { delay } from "../utils"; export class DeleteBackwardChar extends EmacsCommand { public readonly id = "deleteBackwardChar"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { const repeat = prefixArgument === undefined ? 1 : prefixArgument; return makeParallel(repeat, () => vscode.commands.executeCommand("deleteLeft")); } @@ -16,7 +16,7 @@ export class DeleteBackwardChar extends EmacsCommand { export class DeleteForwardChar extends EmacsCommand { public readonly id = "deleteForwardChar"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { const repeat = prefixArgument === undefined ? 1 : prefixArgument; return makeParallel(repeat, () => vscode.commands.executeCommand("deleteRight"), @@ -27,11 +27,7 @@ export class DeleteForwardChar extends EmacsCommand { export class NewLine extends EmacsCommand { public readonly id = "newLine"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { this.emacsController.exitMarkMode(); textEditor.selections = textEditor.selections.map((selection) => new Selection(selection.active, selection.active)); diff --git a/src/commands/find.ts b/src/commands/find.ts index 2dc6517d70..073ea9f046 100644 --- a/src/commands/find.ts +++ b/src/commands/find.ts @@ -63,7 +63,7 @@ abstract class IsearchCommand extends EmacsCommand { export class IsearchForward extends IsearchCommand { public readonly id = "isearchForward"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { this.searchState.startSelections = textEditor.selections; return this.openFindWidget({ isRegex: false }).then(() => @@ -75,7 +75,7 @@ export class IsearchForward extends IsearchCommand { export class IsearchBackward extends IsearchCommand { public readonly id = "isearchBackward"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { this.searchState.startSelections = textEditor.selections; return this.openFindWidget({ isRegex: false }).then(() => vscode.commands.executeCommand("editor.action.previousMatchFindAction"), @@ -86,7 +86,7 @@ export class IsearchBackward extends IsearchCommand { export class IsearchForwardRegexp extends IsearchCommand { public readonly id = "isearchForwardRegexp"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { this.searchState.startSelections = textEditor.selections; return this.openFindWidget({ isRegex: true }).then(() => vscode.commands.executeCommand("editor.action.nextMatchFindAction"), @@ -97,7 +97,7 @@ export class IsearchForwardRegexp extends IsearchCommand { export class IsearchBackwardRegexp extends IsearchCommand { public readonly id = "isearchBackwardRegexp"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { this.searchState.startSelections = textEditor.selections; return this.openFindWidget({ isRegex: true }).then(() => vscode.commands.executeCommand("editor.action.previousMatchFindAction"), @@ -108,7 +108,7 @@ export class IsearchBackwardRegexp extends IsearchCommand { export class QueryReplace extends IsearchCommand { public readonly id = "queryReplace"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { this.searchState.startSelections = textEditor.selections; // I could not find a way to open the find widget with `editor.actions.findWithArgs` // revealing the replace input and restoring the both query and replace strings. @@ -120,7 +120,7 @@ export class QueryReplace extends IsearchCommand { export class QueryReplaceRegexp extends IsearchCommand { public readonly id = "queryReplaceRegexp"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { this.searchState.startSelections = textEditor.selections; // Like `queryReplace` command, I could not find a way to open the find widget with the desired state. // In this command, setting `isRegex` is the priority and I gave up restoring the replace string by setting ´replaceString=undefined`. @@ -134,7 +134,7 @@ export class QueryReplaceRegexp extends IsearchCommand { export class IsearchAbort extends IsearchCommand { public readonly id = "isearchAbort"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { if (this.searchState.startSelections) { textEditor.selections = this.searchState.startSelections; } @@ -150,7 +150,7 @@ export class IsearchAbort extends IsearchCommand { export class IsearchExit extends IsearchCommand { public readonly id = "isearchExit"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { if (this.searchState.startSelections) { this.emacsController.pushMark(this.searchState.startSelections.map((selection) => selection.anchor)); MessageManager.showMessage("Mark saved where search started"); diff --git a/src/commands/index.ts b/src/commands/index.ts index 4023193977..cb436d2ec0 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -14,15 +14,7 @@ export abstract class EmacsCommand { this.emacsController = markModeController; } - public run( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Thenable | void { - return this.execute(textEditor, isInMarkMode, prefixArgument); - } - - public abstract execute( + public abstract run( textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined, diff --git a/src/commands/kill.ts b/src/commands/kill.ts index 6619485123..063a0412da 100644 --- a/src/commands/kill.ts +++ b/src/commands/kill.ts @@ -47,11 +47,7 @@ function findNextKillWordRange(doc: TextDocument, position: Position, repeat = 1 export class KillWord extends KillYankCommand { public readonly id = "killWord"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { const repeat = prefixArgument === undefined ? 1 : prefixArgument; if (repeat <= 0) { return; @@ -85,11 +81,7 @@ function findPreviousKillWordRange(doc: TextDocument, position: Position, repeat export class BackwardKillWord extends KillYankCommand { public readonly id = "backwardKillWord"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { const repeat = prefixArgument === undefined ? 1 : prefixArgument; if (repeat <= 0) { return; @@ -106,7 +98,7 @@ export class BackwardKillWord extends KillYankCommand { export class KillLine extends KillYankCommand { public readonly id = "killLine"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { const killWholeLine = Configuration.instance.killWholeLine; const ranges = textEditor.selections.map((selection) => { @@ -139,7 +131,7 @@ export class KillLine extends KillYankCommand { export class KillWholeLine extends KillYankCommand { public readonly id = "killWholeLine"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { const ranges = textEditor.selections.map( (selection) => // From the beginning of the line to the beginning of the next line @@ -153,11 +145,7 @@ export class KillWholeLine extends KillYankCommand { export class KillRegion extends KillYankCommand { public readonly id = "killRegion"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { const selectionsAfterRectDisabled = this.emacsController.inRectMarkMode && this.emacsController.nativeSelections.map((selection) => { @@ -182,11 +170,7 @@ export class KillRegion extends KillYankCommand { export class CopyRegion extends KillYankCommand { public readonly id = "copyRegion"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { const ranges = getNonEmptySelections(textEditor); await this.killYanker.copy(ranges); this.emacsController.exitMarkMode(); @@ -199,11 +183,7 @@ export class CopyRegion extends KillYankCommand { export class Yank extends KillYankCommand { public readonly id = "yank"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { this.emacsController.pushMark(textEditor.selections.map((selection) => selection.active)); await this.killYanker.yank(); this.emacsController.exitMarkMode(); @@ -214,11 +194,7 @@ export class Yank extends KillYankCommand { export class YankPop extends KillYankCommand { public readonly id = "yankPop"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { await this.killYanker.yankPop(); this.emacsController.exitMarkMode(); revealPrimaryActive(textEditor); diff --git a/src/commands/move.ts b/src/commands/move.ts index f2580e6ab2..bbcb0f89d7 100644 --- a/src/commands/move.ts +++ b/src/commands/move.ts @@ -32,11 +32,7 @@ export const moveCommandIds = [ export class ForwardChar extends EmacsCommand { public readonly id = "forwardChar"; - public execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): void | Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void | Thenable { const charDelta = prefixArgument == undefined ? 1 : prefixArgument; if (this.emacsController.inRectMarkMode) { this.emacsController.moveRectActives((curActive) => curActive.translate(0, charDelta)); @@ -62,11 +58,7 @@ export class ForwardChar extends EmacsCommand { export class BackwardChar extends EmacsCommand { public readonly id = "backwardChar"; - public execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): void | Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void | Thenable { const charDelta = prefixArgument == undefined ? 1 : prefixArgument; if (this.emacsController.inRectMarkMode) { this.emacsController.moveRectActives( @@ -94,11 +86,7 @@ export class BackwardChar extends EmacsCommand { export class NextLine extends EmacsCommand { public readonly id = "nextLine"; - public execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): void | Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void | Thenable { const lineDelta = prefixArgument == undefined ? 1 : prefixArgument; if (this.emacsController.inRectMarkMode) { @@ -121,11 +109,7 @@ export class NextLine extends EmacsCommand { export class PreviousLine extends EmacsCommand { public readonly id = "previousLine"; - public execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): void | Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void | Thenable { const lineDelta = prefixArgument == undefined ? 1 : prefixArgument; if (this.emacsController.inRectMarkMode) { @@ -147,11 +131,7 @@ export class PreviousLine extends EmacsCommand { export class MoveBeginningOfLine extends EmacsCommand { public readonly id = "moveBeginningOfLine"; - public execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): void | Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void | Thenable { if (this.emacsController.inRectMarkMode) { this.emacsController.moveRectActives((curActive) => textEditor.document.lineAt(curActive.line).range.start); } @@ -185,11 +165,7 @@ export class MoveBeginningOfLine extends EmacsCommand { export class MoveEndOfLine extends EmacsCommand { public readonly id = "moveEndOfLine"; - public execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): void | Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void | Thenable { if (this.emacsController.inRectMarkMode) { this.emacsController.moveRectActives((curActive) => textEditor.document.lineAt(curActive.line).range.end); return; @@ -223,7 +199,7 @@ export class MoveEndOfLine extends EmacsCommand { export class ForwardWord extends EmacsCommand { public readonly id = "forwardWord"; - public execute( + public run( textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined, @@ -243,7 +219,7 @@ export class ForwardWord extends EmacsCommand { export class BackwardWord extends EmacsCommand { public readonly id = "backwardWord"; - public execute( + public run( textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined, @@ -263,11 +239,7 @@ export class BackwardWord extends EmacsCommand { export class BackToIndentation extends EmacsCommand { public readonly id = "backToIndentation"; - public execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): void | Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void | Thenable { const doc = textEditor.document; const moveActiveFunc = (active: vscode.Position): vscode.Position => { @@ -294,11 +266,7 @@ export class BackToIndentation extends EmacsCommand { export class BeginningOfBuffer extends EmacsCommand { public readonly id = "beginningOfBuffer"; - public execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): void | Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void | Thenable { if (this.emacsController.inRectMarkMode) { const beginning = textEditor.document.positionAt(0); this.emacsController.moveRectActives(() => beginning); @@ -316,11 +284,7 @@ export class BeginningOfBuffer extends EmacsCommand { export class EndOfBuffer extends EmacsCommand { public readonly id = "endOfBuffer"; - public execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): void | Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void | Thenable { if (this.emacsController.inRectMarkMode) { const end = textEditor.document.lineAt(textEditor.document.lineCount - 1).range.end; this.emacsController.moveRectActives(() => end); @@ -375,11 +339,7 @@ function movePrimaryCursorIntoVisibleRange( export class ScrollUpCommand extends EmacsCommand { public readonly id = "scrollUpCommand"; - public execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): void | Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void | Thenable { if (prefixArgument != null) { return vscode.commands .executeCommand("editorScroll", { @@ -406,11 +366,7 @@ export class ScrollUpCommand extends EmacsCommand { export class ScrollDownCommand extends EmacsCommand { public readonly id = "scrollDownCommand"; - public execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): void | Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void | Thenable { if (prefixArgument != null) { return vscode.commands .executeCommand("editorScroll", { @@ -437,7 +393,7 @@ export class ScrollDownCommand extends EmacsCommand { export class ForwardParagraph extends EmacsCommand { public readonly id = "forwardParagraph"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void { const repeat = prefixArgument === undefined ? 1 : prefixArgument; const doc = textEditor.document; @@ -465,7 +421,7 @@ export class ForwardParagraph extends EmacsCommand { export class BackwardParagraph extends EmacsCommand { public readonly id = "backwardParagraph"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void { const repeat = prefixArgument === undefined ? 1 : prefixArgument; const doc = textEditor.document; diff --git a/src/commands/paredit.ts b/src/commands/paredit.ts index 834841d858..57e4b207a0 100644 --- a/src/commands/paredit.ts +++ b/src/commands/paredit.ts @@ -40,7 +40,7 @@ const makeSexpTravelFunc = (doc: TextDocument, pareditNavigatorFn: PareditNaviga abstract class PareditNavigatorCommand extends EmacsCommand { public abstract readonly pareditNavigatorFn: PareditNavigatorFn; - public async execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined) { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined) { const repeat = prefixArgument === undefined ? 1 : prefixArgument; if (repeat <= 0) { return; @@ -84,11 +84,7 @@ export class MarkSexp extends EmacsCommand { public readonly id = "paredit.markSexp"; private continuing = false; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { const arg = prefixArgument === undefined ? 1 : prefixArgument; const repeat = Math.abs(arg); @@ -127,11 +123,7 @@ export class MarkSexp extends EmacsCommand { export class KillSexp extends KillYankCommand { public readonly id = "paredit.killSexp"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { const repeat = prefixArgument === undefined ? 1 : prefixArgument; if (repeat <= 0) { return; @@ -154,11 +146,7 @@ export class KillSexp extends KillYankCommand { export class BackwardKillSexp extends KillYankCommand { public readonly id = "paredit.backwardKillSexp"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { const repeat = prefixArgument === undefined ? 1 : prefixArgument; if (repeat <= 0) { return; @@ -181,11 +169,7 @@ export class BackwardKillSexp extends KillYankCommand { export class PareditKill extends KillYankCommand { public readonly id = "paredit.pareditKill"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { const repeat = prefixArgument === undefined ? 1 : prefixArgument; if (repeat <= 0) { return; diff --git a/src/commands/recenter.ts b/src/commands/recenter.ts index f3f2bc17b8..f3515fbddd 100644 --- a/src/commands/recenter.ts +++ b/src/commands/recenter.ts @@ -13,7 +13,7 @@ export class RecenterTopBottom extends EmacsCommand implements ITextEditorInterr private recenterPosition: RecenterPosition = RecenterPosition.Middle; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): void { const activeRange = new vscode.Range(textEditor.selection.active, textEditor.selection.active); switch (this.recenterPosition) { diff --git a/src/commands/rectangle.ts b/src/commands/rectangle.ts index 24bdf4e527..1b7d382e40 100644 --- a/src/commands/rectangle.ts +++ b/src/commands/rectangle.ts @@ -31,7 +31,7 @@ export class StartAcceptingRectCommand extends EmacsCommand implements ITextEdit vscode.commands.executeCommand("setContext", "emacs-mcx.acceptingRectCommand", false); } - public execute(): void { + public run(): void { this.startAcceptingRectCommand(); } @@ -76,11 +76,7 @@ abstract class EditRectangle extends RectangleKillYankCommand { protected copy = false; protected delete = false; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { const selections = getNonEmptySelections(textEditor); if (selections.length !== 1) { @@ -144,11 +140,7 @@ const getEolChar = (eol: vscode.EndOfLine): string | undefined => { export class YankRectangle extends RectangleKillYankCommand { public readonly id = "yankRectangle"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { const killedRect = this.rectangleState.latestKilledRectangle; if (killedRect.length === 0) { @@ -202,11 +194,7 @@ export class YankRectangle extends RectangleKillYankCommand { export class OpenRectangle extends EmacsCommand { public readonly id = "openRectangle"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { const selections = getNonEmptySelections(textEditor); if (selections.length === 0) { return; @@ -232,11 +220,7 @@ export class OpenRectangle extends EmacsCommand { export class ClearRectangle extends EmacsCommand { public readonly id = "clearRectangle"; - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { const selections = getNonEmptySelections(textEditor); if (selections.length === 0) { return; @@ -267,11 +251,7 @@ export class StringRectangle extends EmacsCommand { this.minibuffer = minibuffer; } - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { const replaceString = await this.minibuffer.readFromMinibuffer({ prompt: "String rectangle" }); if (replaceString == null) { @@ -306,11 +286,7 @@ export class ReplaceKillRingToRectangle extends EmacsCommand { this.killring = killring; } - public async execute( - textEditor: TextEditor, - isInMarkMode: boolean, - prefixArgument: number | undefined, - ): Promise { + public async run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Promise { if (this.killring === null) { return; } diff --git a/src/commands/registers.ts b/src/commands/registers.ts index db31d30670..aa2b442ee6 100644 --- a/src/commands/registers.ts +++ b/src/commands/registers.ts @@ -18,7 +18,7 @@ export class StartRegisterSaveCommand extends EmacsCommand implements ITextEdito vscode.commands.executeCommand("setContext", "emacs-mcx.inRegisterSaveMode", false); } - public execute(): void { + public run(): void { this.startRegisterSaveCommand(); } @@ -46,7 +46,7 @@ export class StartRegisterInsertCommand extends EmacsCommand implements ITextEdi vscode.commands.executeCommand("setContext", "emacs-mcx.inRegisterInsertMode", false); } - public execute(): void { + public run(): void { this.startRegisterInsertCommand(); } diff --git a/src/commands/tab.ts b/src/commands/tab.ts index b7adc549a4..d112faa33c 100644 --- a/src/commands/tab.ts +++ b/src/commands/tab.ts @@ -5,7 +5,7 @@ import { makeParallel, EmacsCommand } from "."; export class TabToTabStop extends EmacsCommand { public readonly id = "tabToTabStop"; - public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { + public run(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { // A single call of `editor.action.reindentselectedlines` // only affects a first selection which has a not indented line. // So we need to call it as many times as the number of selections.