mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-19 22:59:48 +01:00
workbench embedder API: developmentOptions
This commit is contained in:
@@ -413,13 +413,6 @@ class WindowIndicator implements IWindowIndicator {
|
||||
|
||||
const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = JSON.parse(configElementAttribute);
|
||||
|
||||
// Revive static extension locations
|
||||
if (Array.isArray(config.staticExtensions)) {
|
||||
config.staticExtensions.forEach(extension => {
|
||||
extension.extensionLocation = URI.revive(extension.extensionLocation);
|
||||
});
|
||||
}
|
||||
|
||||
// Find workspace to open and payload
|
||||
let foundWorkspace = false;
|
||||
let workspace: IWorkspace;
|
||||
|
||||
@@ -115,7 +115,7 @@ export class BrowserWindow extends Disposable {
|
||||
private create(): void {
|
||||
|
||||
// Driver
|
||||
if (this.environmentService.options?.driver) {
|
||||
if (this.environmentService.options?.developmentOptions?.enableSmokeTestDriver) {
|
||||
(async () => this._register(await registerWindowDriver()))();
|
||||
}
|
||||
|
||||
|
||||
@@ -282,16 +282,15 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
|
||||
extensionDevelopmentLocationURI: undefined,
|
||||
extensionDevelopmentKind: undefined
|
||||
};
|
||||
|
||||
if (this.options.staticExtensions) {
|
||||
const extensionDevelopmentLocations = this.options.staticExtensions.filter(s => s.isUnderDevelopment).map(e => e.extensionLocation);
|
||||
if (extensionDevelopmentLocations.length) {
|
||||
extensionHostDebugEnvironment.extensionDevelopmentLocationURI = extensionDevelopmentLocations;
|
||||
const developmentOptions = this.options.developmentOptions;
|
||||
if (developmentOptions) {
|
||||
if (developmentOptions.extensions?.length) {
|
||||
extensionHostDebugEnvironment.extensionDevelopmentLocationURI = developmentOptions.extensions.map(e => URI.revive(e.extensionLocation));
|
||||
extensionHostDebugEnvironment.isExtensionDevelopment = true;
|
||||
}
|
||||
}
|
||||
if (this.options.extensionTestsPath) {
|
||||
extensionHostDebugEnvironment.extensionTestsLocationURI = URI.revive(this.options.extensionTestsPath);
|
||||
if (developmentOptions) {
|
||||
extensionHostDebugEnvironment.extensionTestsLocationURI = URI.revive(developmentOptions.extensionTestsPath);
|
||||
}
|
||||
}
|
||||
|
||||
// Fill in selected extra environmental properties
|
||||
|
||||
+21
-3
@@ -97,6 +97,23 @@ export class WebExtensionsScannerService extends Disposable implements IWebExten
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* All dev extesnions
|
||||
*/
|
||||
private getDevExtensions(): IScannedExtension[] {
|
||||
const devExtensions = this.environmentService.options?.developmentOptions?.extensions;
|
||||
const result: IScannedExtension[] = [];
|
||||
if (Array.isArray(devExtensions)) {
|
||||
for (const e of devExtensions) {
|
||||
const scannedExtension = this.parseStaticExtension(e, false, true);
|
||||
if (scannedExtension) {
|
||||
result.push(scannedExtension);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private async readDefaultExtensions(): Promise<IScannedExtension[]> {
|
||||
const defaultUserWebExtensions = await this.readDefaultUserWebExtensions();
|
||||
const extensions: IScannedExtension[] = [];
|
||||
@@ -106,20 +123,21 @@ export class WebExtensionsScannerService extends Disposable implements IWebExten
|
||||
extensions.push(scannedExtension);
|
||||
}
|
||||
}
|
||||
return extensions.concat(this.getStaticExtensions(false));
|
||||
return extensions.concat(this.getStaticExtensions(false), this.getDevExtensions());
|
||||
}
|
||||
|
||||
private parseStaticExtension(e: IStaticExtension, builtin: boolean, isUnderDevelopment: boolean): IScannedExtension | null {
|
||||
const extensionLocation = URI.revive(e.extensionLocation);
|
||||
try {
|
||||
return {
|
||||
identifier: { id: getGalleryExtensionId(e.packageJSON.publisher, e.packageJSON.name) },
|
||||
location: e.extensionLocation,
|
||||
location: extensionLocation,
|
||||
type: builtin ? ExtensionType.System : ExtensionType.User,
|
||||
packageJSON: e.packageJSON,
|
||||
isUnderDevelopment
|
||||
};
|
||||
} catch (error) {
|
||||
this.logService.error(`Error while parsing extension ${e.extensionLocation.toString()}`);
|
||||
this.logService.error(`Error while parsing extension ${extensionLocation.toString()}`);
|
||||
this.logService.error(error);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -26,8 +26,8 @@ interface IResourceUriProvider {
|
||||
|
||||
interface IStaticExtension {
|
||||
packageJSON: IExtensionManifest;
|
||||
extensionLocation: URI;
|
||||
isUnderDevelopment?: boolean;
|
||||
extensionLocation: UriComponents;
|
||||
isBuiltin?: boolean;
|
||||
}
|
||||
|
||||
interface ICommonTelemetryPropertiesResolver {
|
||||
@@ -321,11 +321,6 @@ interface IWorkbenchConstructionOptions {
|
||||
*/
|
||||
readonly staticExtensions?: ReadonlyArray<IStaticExtension>;
|
||||
|
||||
/**
|
||||
* Location of a module containing extension tests to run once the workbench is open.
|
||||
*/
|
||||
readonly extensionTestsPath?: URI;
|
||||
|
||||
/**
|
||||
* [TEMPORARY]: This will be removed soon.
|
||||
* Enable inlined extensions.
|
||||
@@ -415,12 +410,31 @@ interface IWorkbenchConstructionOptions {
|
||||
*/
|
||||
readonly logLevel?: LogLevel;
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region development options
|
||||
|
||||
readonly developmentOptions?: IDevelopmentOptions;
|
||||
|
||||
//#endregion
|
||||
|
||||
}
|
||||
|
||||
interface IDevelopmentOptions {
|
||||
/**
|
||||
* Location of a module containing extension tests to run once the workbench is open.
|
||||
*/
|
||||
readonly extensionTestsPath?: URI;
|
||||
|
||||
/**
|
||||
* Add extensions under development.
|
||||
*/
|
||||
readonly extensions?: ReadonlyArray<IStaticExtension>;
|
||||
|
||||
/**
|
||||
* Whether to enable the smoke test driver.
|
||||
*/
|
||||
readonly driver?: boolean;
|
||||
|
||||
//#endregion
|
||||
readonly enableSmokeTestDriver?: boolean;
|
||||
}
|
||||
|
||||
interface IPerformanceMark {
|
||||
|
||||
Reference in New Issue
Block a user