reduce usage of extensionDevelopmentLocationURI

This commit is contained in:
Martin Aeschlimann 2021-04-16 11:17:20 +02:00
parent 5ef190e98a
commit 1f385f70e6
No known key found for this signature in database
GPG key ID: 2609A01E695523E3
5 changed files with 12 additions and 29 deletions

View file

@ -209,13 +209,13 @@ class SharedProcessMain extends Disposable {
services.set(IExtensionRecommendationNotificationService, new ExtensionRecommendationNotificationServiceChannelClient(this.server.getChannel('extensionRecommendationNotification', activeWindowRouter)));
// Telemetry
const { appRoot, extensionsPath, extensionDevelopmentLocationURI, isBuilt, installSourcePath } = environmentService;
let telemetryService: ITelemetryService;
let telemetryAppender: ITelemetryAppender;
if (!extensionDevelopmentLocationURI && !environmentService.disableTelemetry && productService.enableTelemetry) {
if (!environmentService.isExtensionDevelopment && !environmentService.disableTelemetry && productService.enableTelemetry) {
telemetryAppender = new TelemetryLogAppender(loggerService, environmentService);
const { appRoot, extensionsPath, isBuilt, installSourcePath } = environmentService;
// Application Insights
if (productService.aiConfig && productService.aiConfig.asimovKey && isBuilt) {
const appInsightsAppender = new AppInsightsAppender('monacoworkbench', null, productService.aiConfig.asimovKey);

View file

@ -135,8 +135,6 @@ class CliMain extends Disposable {
const stateService = new StateService(environmentService, logService);
services.set(IStateService, stateService);
const { appRoot, extensionsPath, extensionDevelopmentLocationURI, isBuilt, installSourcePath } = environmentService;
// Request
services.set(IRequestService, new SyncDescriptor(RequestService));
@ -150,11 +148,13 @@ class CliMain extends Disposable {
// Telemetry
const appenders: AppInsightsAppender[] = [];
if (isBuilt && !extensionDevelopmentLocationURI && !environmentService.disableTelemetry && productService.enableTelemetry) {
if (environmentService.isBuilt && !environmentService.isExtensionDevelopment && !environmentService.disableTelemetry && productService.enableTelemetry) {
if (productService.aiConfig && productService.aiConfig.asimovKey) {
appenders.push(new AppInsightsAppender('monacoworkbench', null, productService.aiConfig.asimovKey));
}
const { appRoot, extensionsPath, installSourcePath } = environmentService;
const config: ITelemetryServiceConfig = {
appender: combinedAppender(...appenders),
sendErrorTelemetry: false,

View file

@ -105,7 +105,7 @@ export class ExtensionRecommendationsService extends Disposable implements IExte
}
private isEnabled(): boolean {
return this.galleryService.isEnabled() && !this.environmentService.extensionDevelopmentLocationURI;
return this.galleryService.isEnabled() && !this.environmentService.isExtensionDevelopment;
}
private async activateProactiveRecommendations(): Promise<void> {

View file

@ -437,7 +437,7 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
}
private async _handleExtensionTests(): Promise<void> {
if (!this._environmentService.extensionDevelopmentLocationURI || !this._environmentService.extensionTestsLocationURI) {
if (!this._environmentService.isExtensionDevelopment || !this._environmentService.extensionTestsLocationURI) {
return;
}
@ -691,23 +691,8 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
return extensions.filter(extension => this._isEnabled(extension));
}
private _isExtensionUnderDevelopment(extension: IExtensionDescription): boolean {
if (this._environmentService.isExtensionDevelopment) {
const extDevLocs = this._environmentService.extensionDevelopmentLocationURI;
if (extDevLocs) {
const extLocation = extension.extensionLocation;
for (let p of extDevLocs) {
if (isEqualOrParent(extLocation, p)) {
return true;
}
}
}
}
return false;
}
protected _isEnabled(extension: IExtensionDescription): boolean {
if (this._isExtensionUnderDevelopment(extension)) {
if (extension.isUnderDevelopment) {
// Never disable extensions under development
return true;
}
@ -939,7 +924,7 @@ class ProposedApiController {
this.enableProposedApiForAll =
!_environmentService.isBuilt || // always allow proposed API when running out of sources
(!!_environmentService.extensionDevelopmentLocationURI && productService.quality !== 'stable') || // do not allow proposed API against stable builds when developing an extension
(_environmentService.isExtensionDevelopment && productService.quality !== 'stable') || // do not allow proposed API against stable builds when developing an extension
(this.enableProposedApiFor.length === 0 && Array.isArray(_environmentService.extensionEnabledProposedApi)); // always allow proposed API if --enable-proposed-api is provided without extension ID
this.productAllowProposedApi = new Set<string>();

View file

@ -692,19 +692,17 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
class ThemeFileWatcher {
private inExtensionDevelopment: boolean;
private watchedLocation: URI | undefined;
private watcherDisposable: IDisposable | undefined;
private fileChangeListener: IDisposable | undefined;
constructor(private fileService: IFileService, environmentService: IWorkbenchEnvironmentService, private onUpdate: () => void) {
this.inExtensionDevelopment = !!environmentService.extensionDevelopmentLocationURI;
constructor(private fileService: IFileService, private environmentService: IWorkbenchEnvironmentService, private onUpdate: () => void) {
}
update(theme: { location?: URI, watch?: boolean; }) {
if (!resources.isEqual(theme.location, this.watchedLocation)) {
this.dispose();
if (theme.location && (theme.watch || this.inExtensionDevelopment)) {
if (theme.location && (theme.watch || this.environmentService.isExtensionDevelopment)) {
this.watchedLocation = theme.location;
this.watcherDisposable = this.fileService.watch(theme.location);
this.fileService.onDidFilesChange(e => {