提交 4c3f4a5e 编写于 作者: B Benjamin Pasero

sandbox - some workbench environment cleanup

上级 b67ed348
......@@ -75,7 +75,6 @@ export interface IBestWindowOrFolderOptions<W extends IWindowContext> {
newWindow: boolean;
context: OpenContext;
fileUri?: URI;
userHome?: string;
codeSettingsFolder?: string;
localWorkspaceResolver: (workspace: IWorkspaceIdentifier) => IResolvedWorkspace | null;
}
......
......@@ -6,7 +6,7 @@
import * as crypto from 'crypto';
import { IFileService, IResolveFileResult, IFileStat } from 'vs/platform/files/common/files';
import { IWorkspaceContextService, WorkbenchState, IWorkspace } from 'vs/platform/workspace/common/workspace';
import { IWorkbenchEnvironmentService, IEnvironmentConfiguration } from 'vs/workbench/services/environment/common/environmentService';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { INotificationService, NeverShowAgainScope, INeverShowAgainOptions } from 'vs/platform/notification/common/notification';
import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
......@@ -139,7 +139,7 @@ export class WorkspaceTagsService implements IWorkspaceTagsService {
async getTags(): Promise<Tags> {
if (!this._tags) {
this._tags = await this.resolveWorkspaceTags(this.environmentService.configuration, rootFiles => this.handleWorkspaceFiles(rootFiles));
this._tags = await this.resolveWorkspaceTags(rootFiles => this.handleWorkspaceFiles(rootFiles));
}
return this._tags;
......@@ -297,7 +297,7 @@ export class WorkspaceTagsService implements IWorkspaceTagsService {
"workspace.py.playwright" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
}
*/
private resolveWorkspaceTags(configuration: IEnvironmentConfiguration, participant?: (rootFiles: string[]) => void): Promise<Tags> {
private resolveWorkspaceTags(participant?: (rootFiles: string[]) => void): Promise<Tags> {
const tags: Tags = Object.create(null);
const state = this.contextService.getWorkbenchState();
......@@ -305,7 +305,7 @@ export class WorkspaceTagsService implements IWorkspaceTagsService {
tags['workspace.id'] = this.getTelemetryWorkspaceId(workspace, state);
const { filesToOpenOrCreate, filesToDiff } = configuration;
const { filesToOpenOrCreate, filesToDiff } = this.environmentService.configuration;
tags['workbench.filesToOpenOrCreate'] = filesToOpenOrCreate && filesToOpenOrCreate.length || 0;
tags['workbench.filesToDiff'] = filesToDiff && filesToDiff.length || 0;
......@@ -313,7 +313,7 @@ export class WorkspaceTagsService implements IWorkspaceTagsService {
tags['workspace.roots'] = isEmpty ? 0 : workspace.folders.length;
tags['workspace.empty'] = isEmpty;
const folders = !isEmpty ? workspace.folders.map(folder => folder.uri) : this.productService.quality !== 'stable' && this.findFolders(configuration);
const folders = !isEmpty ? workspace.folders.map(folder => folder.uri) : this.productService.quality !== 'stable' && this.findFolders();
if (!folders || !folders.length || !this.fileService) {
return Promise.resolve(tags);
}
......@@ -524,12 +524,13 @@ export class WorkspaceTagsService implements IWorkspaceTagsService {
}
}
private findFolders(configuration: IEnvironmentConfiguration): URI[] | undefined {
const folder = this.findFolder(configuration);
private findFolders(): URI[] | undefined {
const folder = this.findFolder();
return folder && [folder];
}
private findFolder({ filesToOpenOrCreate, filesToDiff }: IEnvironmentConfiguration): URI | undefined {
private findFolder(): URI | undefined {
const { filesToOpenOrCreate, filesToDiff } = this.environmentService.configuration;
if (filesToOpenOrCreate && filesToOpenOrCreate.length) {
return this.parentURI(filesToOpenOrCreate[0].fileUri);
} else if (filesToDiff && filesToDiff.length) {
......
......@@ -9,17 +9,17 @@ import { URI } from 'vs/base/common/uri';
import { generateUuid } from 'vs/base/common/uuid';
import { BACKUPS, IExtensionHostDebugParams } from 'vs/platform/environment/common/environment';
import { IPath } from 'vs/platform/windows/common/windows';
import { IWorkbenchEnvironmentService, IEnvironmentConfiguration } from 'vs/workbench/services/environment/common/environmentService';
import { IWorkbenchConstructionOptions } from 'vs/workbench/workbench.web.api';
import { IWorkbenchEnvironmentService, IWorkbenchConfiguration } from 'vs/workbench/services/environment/common/environmentService';
import { IWorkbenchConstructionOptions as IWorkbenchOptions } from 'vs/workbench/workbench.web.api';
import product from 'vs/platform/product/common/product';
import { memoize } from 'vs/base/common/decorators';
import { onUnexpectedError } from 'vs/base/common/errors';
import { parseLineAndColumnAware } from 'vs/base/common/extpath';
export class BrowserEnvironmentConfiguration implements IEnvironmentConfiguration {
class BrowserWorkbenchConfiguration implements IWorkbenchConfiguration {
constructor(
private readonly options: IBrowserWorkbenchEnvironmentConstructionOptions,
private readonly options: IBrowserWorkbenchOptions,
private readonly payload: Map<string, string> | undefined,
private readonly backupHome: URI
) { }
......@@ -79,7 +79,7 @@ export class BrowserEnvironmentConfiguration implements IEnvironmentConfiguratio
}
}
interface IBrowserWorkbenchEnvironmentConstructionOptions extends IWorkbenchConstructionOptions {
interface IBrowserWorkbenchOptions extends IWorkbenchOptions {
workspaceId: string;
logsPath: URI;
}
......@@ -96,10 +96,10 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
declare readonly _serviceBrand: undefined;
private _configuration: IEnvironmentConfiguration | undefined = undefined;
get configuration(): IEnvironmentConfiguration {
private _configuration: IWorkbenchConfiguration | undefined = undefined;
get configuration(): IWorkbenchConfiguration {
if (!this._configuration) {
this._configuration = new BrowserEnvironmentConfiguration(this.options, this.payload, this.backupHome);
this._configuration = new BrowserWorkbenchConfiguration(this.options, this.payload, this.backupHome);
}
return this._configuration;
......@@ -237,7 +237,7 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
private payload: Map<string, string> | undefined;
constructor(readonly options: IBrowserWorkbenchEnvironmentConstructionOptions) {
constructor(readonly options: IBrowserWorkbenchOptions) {
if (options.workspaceProvider && Array.isArray(options.workspaceProvider.payload)) {
try {
this.payload = new Map(options.workspaceProvider.payload);
......
......@@ -6,12 +6,12 @@
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IWindowConfiguration } from 'vs/platform/windows/common/windows';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkbenchConstructionOptions } from 'vs/workbench/workbench.web.api';
import type { IWorkbenchConstructionOptions as IWorkbenchOptions } from 'vs/workbench/workbench.web.api';
import { URI } from 'vs/base/common/uri';
export const IWorkbenchEnvironmentService = createDecorator<IWorkbenchEnvironmentService>('environmentService');
export interface IEnvironmentConfiguration extends IWindowConfiguration {
export interface IWorkbenchConfiguration extends IWindowConfiguration {
backupWorkspaceResource?: URI;
}
......@@ -19,9 +19,9 @@ export interface IWorkbenchEnvironmentService extends IEnvironmentService {
readonly _serviceBrand: undefined;
readonly configuration: IEnvironmentConfiguration;
readonly configuration: IWorkbenchConfiguration;
readonly options?: IWorkbenchConstructionOptions;
readonly options?: IWorkbenchOptions;
readonly logFile: URI;
......
......@@ -5,7 +5,7 @@
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkbenchEnvironmentService, IEnvironmentConfiguration } from 'vs/workbench/services/environment/common/environmentService';
import { IWorkbenchEnvironmentService, IWorkbenchConfiguration } from 'vs/workbench/services/environment/common/environmentService';
import { memoize } from 'vs/base/common/decorators';
import { URI } from 'vs/base/common/uri';
import { Schemas } from 'vs/base/common/network';
......@@ -17,7 +17,7 @@ import { isLinux, isWindows } from 'vs/base/common/platform';
export interface INativeWorkbenchEnvironmentService extends IWorkbenchEnvironmentService, INativeEnvironmentService {
readonly configuration: INativeEnvironmentConfiguration;
readonly configuration: INativeWorkbenchConfiguration;
readonly crashReporterDirectory?: string;
readonly crashReporterId?: string;
......@@ -29,7 +29,7 @@ export interface INativeWorkbenchEnvironmentService extends IWorkbenchEnvironmen
readonly extHostLogsPath: URI;
}
export interface INativeEnvironmentConfiguration extends IEnvironmentConfiguration, INativeWindowConfiguration { }
export interface INativeWorkbenchConfiguration extends IWorkbenchConfiguration, INativeWindowConfiguration { }
export class NativeWorkbenchEnvironmentService extends EnvironmentService implements INativeWorkbenchEnvironmentService {
......@@ -79,7 +79,7 @@ export class NativeWorkbenchEnvironmentService extends EnvironmentService implem
get cliPath(): string { return this.doGetCLIPath(); }
constructor(
readonly configuration: INativeEnvironmentConfiguration,
readonly configuration: INativeWorkbenchConfiguration,
readonly execPath: string
) {
super(configuration);
......
......@@ -19,7 +19,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
import { IGalleryExtension, INSTALL_ERROR_NOT_SUPPORTED } from 'vs/platform/extensionManagement/common/extensionManagement';
import { groupByExtension, areSameExtensions, getGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IStaticExtension } from 'vs/workbench/workbench.web.api';
import type { IStaticExtension } from 'vs/workbench/workbench.web.api';
import { Disposable } from 'vs/base/common/lifecycle';
import { Event } from 'vs/base/common/event';
import { localizeManifest } from 'vs/platform/extensionManagement/common/extensionNls';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册