提交 f711344b 编写于 作者: B Benjamin Pasero

debt - lift more configuration properties info environment service

Inline filesToWait, filesToOpenOrCreate, filesToDiff, maximized
上级 c5601021
......@@ -810,12 +810,9 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
};
}
const configuration = this.environmentService.configuration;
if (configuration.filesToOpenOrCreate || configuration.filesToDiff) {
return {
filesToOpenOrCreate: configuration.filesToOpenOrCreate,
filesToDiff: configuration.filesToDiff
};
const { filesToOpenOrCreate, filesToDiff } = this.environmentService;
if (filesToOpenOrCreate || filesToDiff) {
return { filesToOpenOrCreate, filesToDiff };
}
return undefined;
......
......@@ -92,6 +92,11 @@ export class SimpleNativeWorkbenchEnvironmentService implements INativeWorkbench
sessionId = this.configuration.sessionId;
machineId = this.configuration.machineId;
filesToDiff = this.configuration.filesToDiff;
filesToOpenOrCreate = this.configuration.filesToOpenOrCreate;
filesToWait = this.configuration.filesToWait;
windowMaximizedInitially = this.configuration.maximized;
options?: IWorkbenchConstructionOptions | undefined;
logExtensionHostCommunication?: boolean | undefined;
extensionEnabledProposedApi?: string[] | undefined;
......
......@@ -218,7 +218,7 @@ export class NativeWindow extends Disposable {
this._register(this.editorService.onDidVisibleEditorsChange(() => this.onDidVisibleEditorsChange()));
// Listen to editor closing (if we run with --wait)
const filesToWait = this.environmentService.configuration.filesToWait;
const filesToWait = this.environmentService.filesToWait;
if (filesToWait) {
this.trackClosedWaitFiles(filesToWait.waitMarkerFileUri, coalesce(filesToWait.paths.map(path => path.fileUri)));
}
......@@ -265,7 +265,7 @@ export class NativeWindow extends Disposable {
Event.map(Event.filter(this.nativeHostService.onWindowUnmaximize, id => id === this.nativeHostService.windowId), () => false)
)(e => this.onDidChangeMaximized(e)));
this.onDidChangeMaximized(this.environmentService.configuration.maximized ?? false);
this.onDidChangeMaximized(this.environmentService.windowMaximizedInitially ?? false);
// Detect panel position to determine minimum width
this._register(this.layoutService.onPanelPositionChange(pos => {
......
......@@ -229,6 +229,12 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
return `${uri.scheme}://${uri.authority}`;
}
@memoize
get filesToDiff(): IPath[] | undefined { return this.configuration.filesToDiff; }
@memoize
get filesToOpenOrCreate(): IPath[] | undefined { return this.configuration.filesToOpenOrCreate; }
get disableTelemetry(): boolean { return false; }
get verbose(): boolean { return this.payload?.get('verbose') === 'true'; }
......
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IWindowConfiguration } from 'vs/platform/windows/common/windows';
import { IPath, IWindowConfiguration } from 'vs/platform/windows/common/windows';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import type { IWorkbenchConstructionOptions as IWorkbenchOptions } from 'vs/workbench/workbench.web.api';
import { URI } from 'vs/base/common/uri';
......@@ -34,6 +34,9 @@ export interface IWorkbenchEnvironmentService extends IEnvironmentService {
readonly sessionId: string;
readonly filesToOpenOrCreate?: IPath[];
readonly filesToDiff?: IPath[];
readonly logFile: URI;
readonly backupWorkspaceHome?: URI;
......
......@@ -10,6 +10,7 @@ import { URI } from 'vs/base/common/uri';
import { Schemas } from 'vs/base/common/network';
import { join } from 'vs/base/common/path';
import { IProductService } from 'vs/platform/product/common/productService';
import { IPath, IPathsToWaitFor } from 'vs/platform/windows/common/windows';
export class NativeWorkbenchEnvironmentService extends NativeEnvironmentService implements INativeWorkbenchEnvironmentService {
......@@ -58,6 +59,18 @@ export class NativeWorkbenchEnvironmentService extends NativeEnvironmentService
@memoize
get webviewCspSource(): string { return `${Schemas.vscodeWebviewResource}:`; }
@memoize
get filesToDiff(): IPath[] | undefined { return this.configuration.filesToDiff; }
@memoize
get filesToOpenOrCreate(): IPath[] | undefined { return this.configuration.filesToOpenOrCreate; }
@memoize
get filesToWait(): IPathsToWaitFor | undefined { return this.configuration.filesToWait; }
@memoize
get windowMaximizedInitially(): boolean | undefined { return this.configuration.maximized; }
@memoize
get skipReleaseNotes(): boolean { return !!this.args['skip-release-notes']; }
......
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { IWorkbenchConfiguration, IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { INativeWindowConfiguration } from 'vs/platform/windows/common/windows';
import { INativeWindowConfiguration, IPathsToWaitFor } from 'vs/platform/windows/common/windows';
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
import { URI } from 'vs/base/common/uri';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
......@@ -23,6 +23,8 @@ export interface INativeWorkbenchEnvironmentService extends IWorkbenchEnvironmen
readonly machineId: string;
readonly filesToWait?: IPathsToWaitFor;
readonly crashReporterDirectory?: string;
readonly crashReporterId?: string;
......@@ -30,4 +32,7 @@ export interface INativeWorkbenchEnvironmentService extends IWorkbenchEnvironmen
readonly log?: string;
readonly extHostLogsPath: URI;
// TODO@sbatten this should be retrieved somehow differently
readonly windowMaximizedInitially?: boolean;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册