diff --git a/src/cmd_line/commands/file.ts b/src/cmd_line/commands/file.ts index cb8de63cf081..07f633f0b8bd 100644 --- a/src/cmd_line/commands/file.ts +++ b/src/cmd_line/commands/file.ts @@ -49,19 +49,17 @@ export class FileCommand extends node.CommandBase { return active.viewColumn; } - execute(): void { + async execute(): Promise { if (!this._arguments.name) { // Open an empty file if (this._arguments.position === FilePosition.CurrentWindow) { - vscode.commands.executeCommand("workbench.action.files.newUntitledFile"); + await vscode.commands.executeCommand("workbench.action.files.newUntitledFile"); + } else { + await vscode.commands.executeCommand("workbench.action.splitEditor"); + await vscode.commands.executeCommand("workbench.action.files.newUntitledFile"); + await vscode.commands.executeCommand("workbench.action.closeOtherEditors"); } - vscode.commands.executeCommand("workbench.action.splitEditor").then(() => { - vscode.commands.executeCommand("workbench.action.files.newUntitledFile").then(() => { - vscode.commands.executeCommand("workbench.action.closeOtherEditors"); - }); - }); - return; } @@ -70,7 +68,8 @@ export class FileCommand extends node.CommandBase { if (newFilePath !== currentFilePath) { let folder = vscode.Uri.file(newFilePath); - vscode.commands.executeCommand("vscode.open", folder, this.getViewColumn(this._arguments.position === FilePosition.NewWindow)); + await vscode.commands.executeCommand("vscode.open", folder, + this.getViewColumn(this._arguments.position === FilePosition.NewWindow)); } } } \ No newline at end of file diff --git a/src/cmd_line/subparsers/file.ts b/src/cmd_line/subparsers/file.ts index 45664ba18b89..af10afd2c20a 100644 --- a/src/cmd_line/subparsers/file.ts +++ b/src/cmd_line/subparsers/file.ts @@ -8,7 +8,7 @@ export function parseEditFileCommandArgs(args: string): node.FileCommand { return new node.FileCommand({}); } - var scanner = new Scanner(args); + let scanner = new Scanner(args); let name = scanner.nextWord(); return new node.FileCommand({