Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 (#7880)

* Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998

* fix pipelines

* fix strict-null-checks

* add missing files
This commit is contained in:
Anthony Dresser
2019-10-21 22:12:22 -07:00
committed by GitHub
parent 7c9be74970
commit 1e22f47304
913 changed files with 18898 additions and 16536 deletions

View File

@@ -13,6 +13,7 @@ import { handleVetos } from 'vs/platform/lifecycle/common/lifecycle';
import { isMacintosh, isWindows } from 'vs/base/common/platform';
import { Disposable } from 'vs/base/common/lifecycle';
import { Barrier } from 'vs/base/common/async';
import { ParsedArgs } from 'vs/platform/environment/common/environment';
export const ILifecycleMainService = createDecorator<ILifecycleMainService>('lifecycleMainService');
@@ -82,6 +83,11 @@ export interface ILifecycleMainService {
*/
readonly onBeforeWindowUnload: Event<IWindowUnloadEvent>;
/**
* Reload a window. All lifecycle event handlers are triggered.
*/
reload(window: ICodeWindow, cli?: ParsedArgs): Promise<void>;
/**
* Unload a window for the provided reason. All lifecycle event handlers are triggered.
*/
@@ -360,6 +366,15 @@ export class LifecycleMainService extends Disposable implements ILifecycleMainSe
});
}
async reload(window: ICodeWindow, cli?: ParsedArgs): Promise<void> {
// Only reload when the window has not vetoed this
const veto = await this.unload(window, UnloadReason.RELOAD);
if (!veto) {
window.reload(undefined, cli);
}
}
async unload(window: ICodeWindow, reason: UnloadReason): Promise<boolean /* veto */> {
// Always allow to unload a window that is not yet ready
@@ -489,11 +504,11 @@ export class LifecycleMainService extends Disposable implements ILifecycleMainSe
this.logService.trace('Lifecycle#relaunch()');
const args = process.argv.slice(1);
if (options && options.addArgs) {
if (options?.addArgs) {
args.push(...options.addArgs);
}
if (options && options.removeArgs) {
if (options?.removeArgs) {
for (const a of options.removeArgs) {
const idx = args.indexOf(a);
if (idx >= 0) {