Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class Command {
private readonly args: object | null
) {}

public execute() {
public execute(): Thenable<unknown>{
if (this.args === null) {
return vscode.commands.executeCommand(this.exe);
} else {
Expand Down
10 changes: 5 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function refreshUserCommands(context: vscode.ExtensionContext) {

context.subscriptions.push(
vscode.commands.registerCommand(key, async () => {
await multiCommand.execute();
await await multiCommand.execute();
})
);
});
Expand All @@ -109,12 +109,12 @@ export function activate(context: vscode.ExtensionContext) {
async (args = {}) => {
try {
if (args.command) {
await vscode.commands.executeCommand(args.command);
return await vscode.commands.executeCommand(args.command);
} else if (args.sequence) {
const multiCommand = createMultiCommand("", args);
await multiCommand.execute();
return await await multiCommand.execute();
} else {
await pickMultiCommand();
return await await pickMultiCommand();
}
} catch (e) {
vscode.window.showErrorMessage(`${e.message}`);
Expand All @@ -126,7 +126,7 @@ export function activate(context: vscode.ExtensionContext) {
// this method is called when your extension is deactivated
export function deactivate() {}

export async function pickMultiCommand() {
export async function pickMultiCommand(): Promise<Thenable<unknown> | undefined> {
const picks = multiCommands.map((multiCommand) => {
return {
label: multiCommand.label || multiCommand.id,
Expand Down
7 changes: 5 additions & 2 deletions src/multiCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ export class MultiCommand {
readonly sequence: Array<Command>
) {}

public async execute() {
public async execute(): Promise<Thenable<unknown> | unknown> {
let lastOutput: Thenable<unknown> | undefined;
for (let command of this.sequence) {
await command.execute();
lastOutput = command.execute();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does removing await affect the order of execution of the sequence ?
Does the later command execute after the prior command has finished and waited the interval in setting ?

await delay(this.interval || 0);
}

return lastOutput;
}
}

Expand Down