From 7d6fc549839910cc40d904bfb6f032b135e83ea5 Mon Sep 17 00:00:00 2001 From: "Yuichiro Tachibana (Tsuchiya)" Date: Sun, 5 Nov 2023 15:19:51 +0900 Subject: [PATCH] Rename the createParallel() helper to makeParallel (#1737) --- src/commands/edit.ts | 6 +++--- src/commands/index.ts | 2 +- src/commands/move.ts | 6 +++--- src/commands/tab.ts | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/commands/edit.ts b/src/commands/edit.ts index d1a9db3169..b5d7312bfa 100644 --- a/src/commands/edit.ts +++ b/src/commands/edit.ts @@ -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"; @@ -9,7 +9,7 @@ export class DeleteBackwardChar extends EmacsCommand { public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { const repeat = prefixArgument === undefined ? 1 : prefixArgument; - return createParallel(repeat, () => vscode.commands.executeCommand("deleteLeft")); + return makeParallel(repeat, () => vscode.commands.executeCommand("deleteLeft")); } } @@ -18,7 +18,7 @@ export class DeleteForwardChar extends EmacsCommand { public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined): Thenable { const repeat = prefixArgument === undefined ? 1 : prefixArgument; - return createParallel(repeat, () => + return makeParallel(repeat, () => vscode.commands.executeCommand("deleteRight"), ) as Thenable as Thenable; } diff --git a/src/commands/index.ts b/src/commands/index.ts index 2bf2f8e11a..d092fd2431 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -1,7 +1,7 @@ import { TextEditor } from "vscode"; import { IEmacsController } from "../emulator"; -export function createParallel(concurrency: number, promiseFactory: () => Thenable): Thenable { +export function makeParallel(concurrency: number, promiseFactory: () => Thenable): Thenable { return Promise.all(Array.from({ length: concurrency }, promiseFactory)); } diff --git a/src/commands/move.ts b/src/commands/move.ts index a74d71428c..f2580e6ab2 100644 --- a/src/commands/move.ts +++ b/src/commands/move.ts @@ -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, @@ -234,7 +234,7 @@ export class ForwardWord extends EmacsCommand { } const repeat = prefixArgument === undefined ? 1 : prefixArgument; - return createParallel(repeat, () => + return makeParallel(repeat, () => vscode.commands.executeCommand(isInMarkMode ? "cursorWordRightSelect" : "cursorWordRight"), ); } @@ -254,7 +254,7 @@ export class BackwardWord extends EmacsCommand { } const repeat = prefixArgument === undefined ? 1 : prefixArgument; - return createParallel(repeat, () => + return makeParallel(repeat, () => vscode.commands.executeCommand(isInMarkMode ? "cursorWordLeftSelect" : "cursorWordLeft"), ); } diff --git a/src/commands/tab.ts b/src/commands/tab.ts index 1821ad8eb5..b7adc549a4 100644 --- a/src/commands/tab.ts +++ b/src/commands/tab.ts @@ -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"; @@ -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) => {