Merge from vscode 313ede61cbad8f9dc748907b3384e059ddddb79a (#7436)

* Merge from vscode 313ede61cbad8f9dc748907b3384e059ddddb79a

* fix strict null checks
This commit is contained in:
Anthony Dresser
2019-09-30 23:35:45 -07:00
committed by GitHub
parent 6ab03053a0
commit 084524cd2d
196 changed files with 2927 additions and 2547 deletions

View File

@@ -9,7 +9,7 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import { IResourceEditor, IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IWindowSettings, IWindowOpenable, IOpenInWindowOptions, isFolderToOpen, isWorkspaceToOpen, isFileToOpen, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows';
import { IWindowSettings, IWindowOpenable, IOpenWindowOptions, isFolderToOpen, isWorkspaceToOpen, isFileToOpen, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows';
import { pathsToEditors } from 'vs/workbench/common/editor';
import { IFileService } from 'vs/platform/files/common/files';
import { ILabelService } from 'vs/platform/label/common/label';
@@ -46,13 +46,6 @@ export class BrowserHostService extends Disposable implements IHostService {
_serviceBrand: undefined;
//#region Events
get onDidChangeFocus(): Event<boolean> { return this._onDidChangeFocus; }
private _onDidChangeFocus: Event<boolean>;
//#endregion
private workspaceProvider: IWorkspaceProvider;
constructor(
@@ -87,11 +80,28 @@ export class BrowserHostService extends Disposable implements IHostService {
);
}
//#region Window
get onDidChangeFocus(): Event<boolean> { return this._onDidChangeFocus; }
private _onDidChangeFocus: Event<boolean>;
readonly windowCount = Promise.resolve(1);
get hasFocus(): boolean {
return document.hasFocus();
}
async openInWindow(toOpen: IWindowOpenable[], options?: IOpenInWindowOptions): Promise<void> {
async focus(): Promise<void> {
window.focus();
}
openWindow(options?: IOpenEmptyWindowOptions): Promise<void>;
openWindow(toOpen: IWindowOpenable[], options?: IOpenWindowOptions): Promise<void>;
openWindow(arg1?: IOpenEmptyWindowOptions | IWindowOpenable[], arg2?: IOpenWindowOptions): Promise<void> {
if (Array.isArray(arg1)) {
return this.doOpenWindow(arg1, arg2);
}
return this.doOpenEmptyWindow(arg1);
}
private async doOpenWindow(toOpen: IWindowOpenable[], options?: IOpenWindowOptions): Promise<void> {
for (let i = 0; i < toOpen.length; i++) {
const openable = toOpen[i];
openable.label = openable.label || this.getRecentLabel(openable);
@@ -126,7 +136,7 @@ export class BrowserHostService extends Disposable implements IHostService {
return this.labelService.getUriLabel(openable.fileUri);
}
private shouldReuse(options: IOpenInWindowOptions = {}): boolean {
private shouldReuse(options: IOpenWindowOptions = {}): boolean {
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
const openFolderInNewWindowConfig = (windowConfig && windowConfig.openFoldersInNewWindow) || 'default' /* default */;
@@ -138,8 +148,8 @@ export class BrowserHostService extends Disposable implements IHostService {
return !openFolderInNewWindow;
}
async openEmptyWindow(options?: IOpenEmptyWindowOptions): Promise<void> {
this.workspaceProvider.open(undefined, { reuse: options && options.reuse });
private async doOpenEmptyWindow(options?: IOpenEmptyWindowOptions): Promise<void> {
this.workspaceProvider.open(undefined, { reuse: options && options.forceReuseWindow });
}
async toggleFullScreen(): Promise<void> {
@@ -176,16 +186,6 @@ export class BrowserHostService extends Disposable implements IHostService {
}
}
get hasFocus(): boolean {
return document.hasFocus();
}
async focus(): Promise<void> {
window.focus();
}
//#endregion
async restart(): Promise<void> {
this.reload();
}
@@ -195,7 +195,7 @@ export class BrowserHostService extends Disposable implements IHostService {
}
async closeWorkspace(): Promise<void> {
return this.openEmptyWindow({ reuse: true });
return this.doOpenEmptyWindow({ forceReuseWindow: true });
}
}