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

Add an option to allow to open in new window after git initializing or cloning #69763

Merged
merged 2 commits into from
Jun 12, 2019
Merged
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
20 changes: 14 additions & 6 deletions extensions/git/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,15 @@ export class CommandCenter {
);

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

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

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

const choices = [];
let message = localize('proposeopen init', "Would you like to open the initialized repository?");
const open = localize('openrepo', "Open Repository");
let message = localize('proposeopen init', "Where would you like to open the initialized repository?");
const open = localize('openrepo', "Current Window");
const openNewWindow = localize('openreponew', "New Window");
choices.push(open);
choices.push(openNewWindow);

if (!askToOpen) {
return;
}

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

Expand All @@ -601,6 +607,8 @@ export class CommandCenter {
commands.executeCommand('vscode.openFolder', uri);
} else if (result === addToWorkspace) {
workspace.updateWorkspaceFolders(workspace.workspaceFolders!.length, 0, { uri });
} else if (result === openNewWindow) {
commands.executeCommand('vscode.openFolder', uri, true);
} else {
await this.model.openRepository(repositoryPath);
}
Expand Down