Skip to content

Commit

Permalink
Adds support for the new window parameter in the keybindings args.
Browse files Browse the repository at this point in the history
  • Loading branch information
mihai-vlc committed Jan 30, 2022
1 parent 1ff9d6a commit ae5fb9d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/UriHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ class CustomUriHandler implements vscode.UriHandler {

if (args.newWindow) {
this.context.globalState.update("postponedCommand", commandData);
vscode.commands.executeCommand("workbench.action.newWindow");

// doing this to allow the new window to take the focus
setTimeout(() => {
vscode.commands.executeCommand("workbench.action.newWindow");
}, 200);
} else {
this.commandsProcessor.parseCommand(commandData);
this.commandsProcessor.executeCommands();
Expand Down
13 changes: 11 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,17 @@ export async function activate(context: vscode.ExtensionContext) {
uriHandler.register();

vscode.commands.registerCommand("vscode-commands-executor.run", (args) => {
commandsProcessor.parseCommand(args);
commandsProcessor.executeCommands();
if (args && args.args && args.args.newWindow) {
context.globalState.update("postponedCommand", args);

// doing this to allow the new window to take the focus
setTimeout(() => {
vscode.commands.executeCommand("workbench.action.newWindow");
}, 200);
} else {
commandsProcessor.parseCommand(args);
commandsProcessor.executeCommands();
}
});
}

Expand Down

0 comments on commit ae5fb9d

Please sign in to comment.