diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index ed367db9cc4..9b20e9487bb 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -351,7 +351,6 @@ export class CommandCenter { const config = workspace.getConfiguration('git'); let value = config.get('defaultCloneDirectory') || os.homedir(); - value = value.replace(/^~/, os.homedir()); const parentPath = await window.showInputBox({ prompt: localize('parent', "Parent Directory"), @@ -379,7 +378,7 @@ export class CommandCenter { statusBarItem.command = cancelCommandId; statusBarItem.show(); - const clonePromise = this.git.clone(url, parentPath, tokenSource.token); + const clonePromise = this.git.clone(url, parentPath.replace(/^~/, os.homedir()), tokenSource.token); try { window.withProgress({ location: ProgressLocation.SourceControl, title: localize('cloning', "Cloning git repository...") }, () => clonePromise); @@ -1326,7 +1325,7 @@ export class CommandCenter { const remoteRefs = repository.refs; const remoteRefsFiltered = remoteRefs.filter(r => (r.remote === remotePick.label)); - const branchPicks = remoteRefsFiltered.map(r => ({ label: r.name})) as {label : string; description : string}[]; + const branchPicks = remoteRefsFiltered.map(r => ({ label: r.name })) as { label: string; description: string }[]; const branchPick = await window.showQuickPick(branchPicks, { placeHolder }); if (!branchPick) { @@ -1335,7 +1334,7 @@ export class CommandCenter { const remoteCharCnt = remotePick.label.length; - repository.pull(false, remotePick.label, branchPick.label.slice(remoteCharCnt+1)); + repository.pull(false, remotePick.label, branchPick.label.slice(remoteCharCnt + 1)); } @command('git.pull', { repository: true }) diff --git a/src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts b/src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts index 646fe879453..c8079172f45 100644 --- a/src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts +++ b/src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts @@ -66,8 +66,14 @@ Registry.as(WorkbenchActionExtensions.WorkbenchActions Registry.as(ConfigurationExtensions.Configuration).registerConfiguration({ id: 'scm', order: 5, + title: localize('scmConfigurationTitle', "SCM"), type: 'object', properties: { + 'scm.alwaysShowProviders': { + type: 'boolean', + description: localize('alwaysShowProviders', "Whether to always show the Source Control Provider section."), + default: false + }, 'scm.diffDecorations': { type: 'string', enum: ['all', 'gutter', 'overview', 'none'], diff --git a/src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts b/src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts index af7f2a6a9b6..84b6588527b 100644 --- a/src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts +++ b/src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts @@ -8,7 +8,7 @@ import 'vs/css!./media/scmViewlet'; import { localize } from 'vs/nls'; import { TPromise } from 'vs/base/common/winjs.base'; -import Event, { Emitter, chain, mapEvent, anyEvent } from 'vs/base/common/event'; +import Event, { Emitter, chain, mapEvent, anyEvent, filterEvent } from 'vs/base/common/event'; import { domEvent, stop } from 'vs/base/browser/event'; import { basename } from 'vs/base/common/paths'; import { onUnexpectedError } from 'vs/base/common/errors'; @@ -1035,7 +1035,8 @@ export class SCMViewlet extends PanelViewlet implements IViewModel { @IWorkbenchEditorService protected editorService: IWorkbenchEditorService, @IWorkspaceContextService contextService: IWorkspaceContextService, @IStorageService storageService: IStorageService, - @IExtensionService extensionService: IExtensionService + @IExtensionService extensionService: IExtensionService, + @IConfigurationService private configurationService: IConfigurationService ) { super(VIEWLET_ID, { showHeaderInTitleWhenSingleView: true }, telemetryService, themeService); @@ -1054,6 +1055,10 @@ export class SCMViewlet extends PanelViewlet implements IViewModel { this.scmService.onDidAddRepository(this.onDidAddRepository, this, this.disposables); this.scmService.onDidRemoveRepository(this.onDidRemoveRepository, this, this.disposables); this.scmService.repositories.forEach(r => this.onDidAddRepository(r)); + + const onDidUpdateConfiguration = filterEvent(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.alwaysShowProviders')); + onDidUpdateConfiguration(this.onDidChangeRepositories, this, this.disposables); + this.onDidChangeRepositories(); } @@ -1087,7 +1092,8 @@ export class SCMViewlet extends PanelViewlet implements IViewModel { private onDidChangeRepositories(): void { toggleClass(this.el, 'empty', this.scmService.repositories.length === 0); - const shouldMainPanelBeVisible = this.scmService.repositories.length > 1; + const shouldMainPanelAlwaysBeVisible = this.configurationService.getValue('scm.alwaysShowProviders'); + const shouldMainPanelBeVisible = shouldMainPanelAlwaysBeVisible || this.scmService.repositories.length > 1; if (!!this.mainPanel === shouldMainPanelBeVisible) { return;