Skip to content

Commit 608035a

Browse files
abbychauabby
authored andcommitted
Add an option to allow to open in new window after -
git initializing or cloning
1 parent e96ab81 commit 608035a

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

extensions/git/src/commands.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { Uri, commands, Disposable, window, workspace, QuickPickItem, OutputChannel, Range, WorkspaceEdit, Position, LineChange, SourceControlResourceState, TextDocumentShowOptions, ViewColumn, ProgressLocation, TextEditor, MessageOptions, WorkspaceFolder } from 'vscode';
6+
import { Uri, commands, Disposable, window, workspace, QuickPickItem, OutputChannel, Range, WorkspaceEdit, Position, LineChange, SourceControlResourceState, TextDocumentShowOptions, ViewColumn, ProgressLocation, TextEditor, MessageOptions, WorkspaceFolder, CommentThreadCollapsibleState } from 'vscode';
77
import { Git, CommitOptions, Stash, ForcePushMode } from './git';
88
import { Repository, Resource, ResourceGroupType } from './repository';
99
import { Model } from './model';
@@ -468,13 +468,15 @@ export class CommandCenter {
468468
);
469469

470470
const choices = [];
471-
let message = localize('proposeopen', "Would you like to open the cloned repository?");
472-
const open = localize('openrepo', "Open Repository");
471+
let message = localize('proposeopen', "Where would you to open the cloned repository?");
472+
const open = localize('openrepo', "Current Window");
473+
const openNewWindow = localize('openreponew', "New Window");
473474
choices.push(open);
475+
choices.push(openNewWindow);
474476

475477
const addToWorkspace = localize('add', "Add to Workspace");
476478
if (workspace.workspaceFolders) {
477-
message = localize('proposeopen2', "Would you like to open the cloned repository, or add it to the current workspace?");
479+
message = localize('proposeopen2', "Where would you like to open the cloned repository, or add it to the current workspace?");
478480
choices.push(addToWorkspace);
479481
}
480482

@@ -495,6 +497,8 @@ export class CommandCenter {
495497
commands.executeCommand('vscode.openFolder', uri);
496498
} else if (result === addToWorkspace) {
497499
workspace.updateWorkspaceFolders(workspace.workspaceFolders!.length, 0, { uri });
500+
} else if (result === openNewWindow) {
501+
commands.executeCommand('vscode.openFolder', uri, true);
498502
}
499503
} catch (err) {
500504
if (/already exists and is not an empty directory/.test(err && err.stderr || '')) {
@@ -580,17 +584,19 @@ export class CommandCenter {
580584
await this.git.init(repositoryPath);
581585

582586
const choices = [];
583-
let message = localize('proposeopen init', "Would you like to open the initialized repository?");
584-
const open = localize('openrepo', "Open Repository");
587+
let message = localize('proposeopen init', "Where would you like to open the initialized repository?");
588+
const open = localize('openrepo', "Current Window");
589+
const openNewWindow = localize('openreponew', "New Window");
585590
choices.push(open);
591+
choices.push(openNewWindow);
586592

587593
if (!askToOpen) {
588594
return;
589595
}
590596

591597
const addToWorkspace = localize('add', "Add to Workspace");
592598
if (workspace.workspaceFolders) {
593-
message = localize('proposeopen2 init', "Would you like to open the initialized repository, or add it to the current workspace?");
599+
message = localize('proposeopen2 init', "Where would you like to open the initialized repository, or add it to the current workspace?");
594600
choices.push(addToWorkspace);
595601
}
596602

@@ -601,6 +607,8 @@ export class CommandCenter {
601607
commands.executeCommand('vscode.openFolder', uri);
602608
} else if (result === addToWorkspace) {
603609
workspace.updateWorkspaceFolders(workspace.workspaceFolders!.length, 0, { uri });
610+
} else if (result === openNewWindow) {
611+
commands.executeCommand('vscode.openFolder', uri, true);
604612
} else {
605613
await this.model.openRepository(repositoryPath);
606614
}

0 commit comments

Comments
 (0)