From 608035ad4951b851bb7a5497c8ab3beb22fd6570 Mon Sep 17 00:00:00 2001 From: Abby Date: Mon, 4 Mar 2019 14:29:38 +0900 Subject: [PATCH 1/3] Add an option to allow to open in new window after - git initializing or cloning --- extensions/git/src/commands.ts | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 8344525db3d..69ffef0af67 100755 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Uri, commands, Disposable, window, workspace, QuickPickItem, OutputChannel, Range, WorkspaceEdit, Position, LineChange, SourceControlResourceState, TextDocumentShowOptions, ViewColumn, ProgressLocation, TextEditor, MessageOptions, WorkspaceFolder } from 'vscode'; +import { Uri, commands, Disposable, window, workspace, QuickPickItem, OutputChannel, Range, WorkspaceEdit, Position, LineChange, SourceControlResourceState, TextDocumentShowOptions, ViewColumn, ProgressLocation, TextEditor, MessageOptions, WorkspaceFolder, CommentThreadCollapsibleState } from 'vscode'; import { Git, CommitOptions, Stash, ForcePushMode } from './git'; import { Repository, Resource, ResourceGroupType } from './repository'; import { Model } from './model'; @@ -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); } @@ -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 || '')) { @@ -580,9 +584,11 @@ 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; @@ -590,7 +596,7 @@ export class CommandCenter { 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); } @@ -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); } From 455cdf3955614cfdde2a652bc867282bdeba7a7f Mon Sep 17 00:00:00 2001 From: Abby Date: Mon, 4 Mar 2019 14:50:27 +0900 Subject: [PATCH 2/3] remove unused dependency (to fix CI) --- extensions/git/src/commands.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 69ffef0af67..e93d41ccc73 100755 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Uri, commands, Disposable, window, workspace, QuickPickItem, OutputChannel, Range, WorkspaceEdit, Position, LineChange, SourceControlResourceState, TextDocumentShowOptions, ViewColumn, ProgressLocation, TextEditor, MessageOptions, WorkspaceFolder, CommentThreadCollapsibleState } from 'vscode'; +import { Uri, commands, Disposable, window, workspace, QuickPickItem, OutputChannel, Range, WorkspaceEdit, Position, LineChange, SourceControlResourceState, TextDocumentShowOptions, ViewColumn, ProgressLocation, TextEditor, MessageOptions, WorkspaceFolder } from 'vscode'; import { Git, CommitOptions, Stash, ForcePushMode } from './git'; import { Repository, Resource, ResourceGroupType } from './repository'; import { Model } from './model'; From 718f19e8abb45982e874329eff03b304e6892818 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Wed, 12 Jun 2019 12:40:16 +0200 Subject: [PATCH 3/3] :lipstick: --- extensions/git/src/commands.ts | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index f46576cd791..85ec8ce866a 100755 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -487,16 +487,14 @@ export class CommandCenter { (_, token) => this.git.clone(url!, parentPath, token) ); - const choices = []; - 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); + let message = localize('proposeopen', "Would you like to open the cloned repository?"); + const open = localize('openrepo', "Open"); + const openNewWindow = localize('openreponew', "Open in New Window"); + const choices = [open, openNewWindow]; const addToWorkspace = localize('add', "Add to Workspace"); if (workspace.workspaceFolders) { - message = localize('proposeopen2', "Where would you like to open the cloned repository, or add it to the current workspace?"); + message = localize('proposeopen2', "Would you like to open the cloned repository, or add it to the current workspace?"); choices.push(addToWorkspace); } @@ -603,12 +601,10 @@ export class CommandCenter { await this.git.init(repositoryPath); - const choices = []; - 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); + let message = localize('proposeopen init', "Would you like to open the initialized repository?"); + const open = localize('openrepo', "Open"); + const openNewWindow = localize('openreponew', "Open in New Window"); + const choices = [open, openNewWindow]; if (!askToOpen) { return; @@ -616,7 +612,7 @@ export class CommandCenter { const addToWorkspace = localize('add', "Add to Workspace"); if (workspace.workspaceFolders) { - message = localize('proposeopen2 init', "Where would you like to open the initialized repository, or add it to the current workspace?"); + message = localize('proposeopen2 init', "Would you like to open the initialized repository, or add it to the current workspace?"); choices.push(addToWorkspace); }