Skip to content

Commit

Permalink
Rename the createParallel() helper to makeParallel (#1737)
Browse files Browse the repository at this point in the history
  • Loading branch information
whitphx committed Nov 5, 2023
1 parent fb0d92d commit 7d6fc54
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/commands/edit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vscode from "vscode";
import { Range, Selection, TextEditor } from "vscode";
import { createParallel, EmacsCommand } from ".";
import { makeParallel, EmacsCommand } from ".";
import { revealPrimaryActive } from "./helpers/reveal";
import { delay } from "../utils";

Expand All @@ -9,7 +9,7 @@ export class DeleteBackwardChar extends EmacsCommand {

public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable<unknown> {
const repeat = prefixArgument === undefined ? 1 : prefixArgument;
return createParallel(repeat, () => vscode.commands.executeCommand("deleteLeft"));
return makeParallel(repeat, () => vscode.commands.executeCommand("deleteLeft"));
}
}

Expand All @@ -18,7 +18,7 @@ export class DeleteForwardChar extends EmacsCommand {

public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable<void> {
const repeat = prefixArgument === undefined ? 1 : prefixArgument;
return createParallel(repeat, () =>
return makeParallel(repeat, () =>
vscode.commands.executeCommand<void>("deleteRight"),
) as Thenable<unknown> as Thenable<void>;
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TextEditor } from "vscode";
import { IEmacsController } from "../emulator";

export function createParallel<T>(concurrency: number, promiseFactory: () => Thenable<T>): Thenable<T[]> {
export function makeParallel<T>(concurrency: number, promiseFactory: () => Thenable<T>): Thenable<T[]> {
return Promise.all(Array.from({ length: concurrency }, promiseFactory));
}

Expand Down
6 changes: 3 additions & 3 deletions src/commands/move.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vscode from "vscode";
import { TextEditor } from "vscode";
import { createParallel, EmacsCommand } from ".";
import { makeParallel, EmacsCommand } from ".";
import { Configuration } from "../configuration/configuration";
import {
travelForward as travelForwardParagraph,
Expand Down Expand Up @@ -234,7 +234,7 @@ export class ForwardWord extends EmacsCommand {
}

const repeat = prefixArgument === undefined ? 1 : prefixArgument;
return createParallel(repeat, () =>
return makeParallel(repeat, () =>
vscode.commands.executeCommand<void>(isInMarkMode ? "cursorWordRightSelect" : "cursorWordRight"),
);
}
Expand All @@ -254,7 +254,7 @@ export class BackwardWord extends EmacsCommand {
}

const repeat = prefixArgument === undefined ? 1 : prefixArgument;
return createParallel(repeat, () =>
return makeParallel(repeat, () =>
vscode.commands.executeCommand<void>(isInMarkMode ? "cursorWordLeftSelect" : "cursorWordLeft"),
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/tab.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vscode from "vscode";
import { Selection, TextEditor } from "vscode";
import { createParallel, EmacsCommand } from ".";
import { makeParallel, EmacsCommand } from ".";

export class TabToTabStop extends EmacsCommand {
public readonly id = "tabToTabStop";
Expand All @@ -9,7 +9,7 @@ export class TabToTabStop extends EmacsCommand {
// 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.
return createParallel(textEditor.selections.length, () =>
return makeParallel(textEditor.selections.length, () =>
vscode.commands.executeCommand("editor.action.reindentselectedlines"),
).then(() => {
textEditor.selections = textEditor.selections.map((selection) => {
Expand Down

0 comments on commit 7d6fc54

Please sign in to comment.