Merge from vscode 2a36b7d0d527bf408bae4f96b8386db9d9455113 (#10237)

This commit is contained in:
Anthony Dresser
2020-04-30 23:41:35 -07:00
committed by GitHub
parent d7a425239b
commit cebbd04d10
60 changed files with 361 additions and 240 deletions

View File

@@ -44,7 +44,7 @@ import { LineNumbersType } from 'vs/editor/common/config/editorOptions';
import { ActivitybarPart } from 'vs/workbench/browser/parts/activitybar/activitybarPart';
import { URI } from 'vs/base/common/uri';
enum Settings {
export enum Settings {
ACTIVITYBAR_VISIBLE = 'workbench.activityBar.visible',
STATUSBAR_VISIBLE = 'workbench.statusBar.visible',
@@ -52,6 +52,7 @@ enum Settings {
PANEL_POSITION = 'workbench.panel.defaultLocation',
ZEN_MODE_RESTORE = 'zenMode.restore',
WORKSPACE_FIRST_OPEN = 'workbench.workspaceFirstOpen'
}
enum Storage {
@@ -547,7 +548,12 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
private applyDefaultLayout(environmentService: IWorkbenchEnvironmentService, storageService: IStorageService) {
const defaultLayout = environmentService.options?.defaultLayout;
if (!defaultLayout || !defaultLayout.firstRun) {
if (!defaultLayout) {
return;
}
const firstOpen = storageService.getBoolean(Settings.WORKSPACE_FIRST_OPEN, StorageScope.WORKSPACE);
if (!firstOpen) {
return;
}
@@ -752,14 +758,25 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
return [];
}
private _openedDefaultEditors: boolean = false;
get openedDefaultEditors() {
return this._openedDefaultEditors;
}
private getInitialFilesToOpen(): { filesToOpenOrCreate?: IPath[], filesToDiff?: IPath[] } | undefined {
const defaultLayout = this.environmentService.options?.defaultLayout;
if (defaultLayout?.firstRun && defaultLayout?.editors?.length) {
//
if (defaultLayout?.editors?.length && this.storageService.getBoolean(Settings.WORKSPACE_FIRST_OPEN, StorageScope.WORKSPACE)) {
this._openedDefaultEditors = true;
return {
filesToOpenOrCreate: defaultLayout.editors
.sort((a, b) => (a.active ? -1 : 1) - (b.active ? -1 : 1))
.map(f => ({ fileUri: URI.file(f.path).with({ scheme: f.scheme }), inactive: !f.active }))
.map<IPath>(f => {
// Support the old path+scheme api until embedders can migrate
if ('path' in f && 'scheme' in f) {
return { fileUri: URI.file((f as any).path).with({ scheme: (f as any).scheme }) };
}
return { fileUri: URI.revive(f.uri), openOnlyIfExists: f.openOnlyIfExists };
})
};
}