Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename the createParallel() helper to makeParallel #1737

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 Expand Up @@ -33,6 +33,6 @@
onDidInterruptTextEditor(): void;
}

export function instanceOfIEmacsCommandInterrupted(obj: any): obj is IEmacsCommandInterrupted {

Check warning on line 36 in src/commands/index.ts

View workflow job for this annotation

GitHub Actions / build (macos-latest, native)

Argument 'obj' should be typed with a non-any type

Check warning on line 36 in src/commands/index.ts

View workflow job for this annotation

GitHub Actions / build (macos-latest, native)

Unexpected any. Specify a different type

Check warning on line 36 in src/commands/index.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, native)

Argument 'obj' should be typed with a non-any type

Check warning on line 36 in src/commands/index.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, native)

Unexpected any. Specify a different type

Check warning on line 36 in src/commands/index.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest, native)

Argument 'obj' should be typed with a non-any type

Check warning on line 36 in src/commands/index.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest, native)

Unexpected any. Specify a different type

Check warning on line 36 in src/commands/index.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, web)

Argument 'obj' should be typed with a non-any type

Check warning on line 36 in src/commands/index.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, web)

Unexpected any. Specify a different type
return typeof obj.onDidInterruptTextEditor === "function";
}
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
Loading