diff --git a/src/vs/workbench/api/electron-browser/mainThreadMessageService.ts b/src/vs/workbench/api/electron-browser/mainThreadMessageService.ts index 92ca4c3cb44..6417bd2abea 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadMessageService.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadMessageService.ts @@ -14,7 +14,6 @@ import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { once } from 'vs/base/common/event'; import { ICommandService } from 'vs/platform/commands/common/commands'; -import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { dispose } from 'vs/base/common/lifecycle'; @extHostNamedCustomer(MainContext.MainThreadMessageService) @@ -24,8 +23,7 @@ export class MainThreadMessageService implements MainThreadMessageServiceShape { extHostContext: IExtHostContext, @INotificationService private readonly _notificationService: INotificationService, @ICommandService private readonly _commandService: ICommandService, - @IDialogService private readonly _dialogService: IDialogService, - @IEnvironmentService private readonly _environmentService: IEnvironmentService + @IDialogService private readonly _dialogService: IDialogService ) { // } @@ -79,7 +77,7 @@ export class MainThreadMessageService implements MainThreadMessageServiceShape { } const secondaryActions: IAction[] = []; - if (extension && extension.extensionFolderPath !== this._environmentService.extensionDevelopmentPath) { + if (extension && !extension.isUnderDevelopment) { secondaryActions.push(new ManageExtensionAction(extension.id, nls.localize('manageExtension', "Manage Extension"), this._commandService)); } diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index e9b778b850d..da6605616d5 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -146,7 +146,7 @@ export function createApiFactory( // We only inform once, it is not a warning because we just want to raise awareness and because // we cannot say if the extension is doing it right or wrong... let checkSelector = (function () { - let done = initData.environment.extensionDevelopmentPath !== extension.extensionFolderPath; + let done = (!extension.isUnderDevelopment); function informOnce(selector: vscode.DocumentSelector) { if (!done) { console.info(`Extension '${extension.id}' uses a document selector without scheme. Learn more about this: https://go.microsoft.com/fwlink/?linkid=872305`); diff --git a/src/vs/workbench/services/extensions/common/extensions.ts b/src/vs/workbench/services/extensions/common/extensions.ts index b4569cf284b..e61488831ba 100644 --- a/src/vs/workbench/services/extensions/common/extensions.ts +++ b/src/vs/workbench/services/extensions/common/extensions.ts @@ -41,7 +41,6 @@ export const IExtensionService = createDecorator('extensionSe export interface IMessage { type: Severity; message: string; - source: string; extensionId: string; extensionPointId: string; } diff --git a/src/vs/workbench/services/extensions/common/extensionsRegistry.ts b/src/vs/workbench/services/extensions/common/extensionsRegistry.ts index 21c541c470f..c21f0dd7858 100644 --- a/src/vs/workbench/services/extensions/common/extensionsRegistry.ts +++ b/src/vs/workbench/services/extensions/common/extensionsRegistry.ts @@ -36,7 +36,6 @@ export class ExtensionMessageCollector { this._messageHandler({ type: type, message: message, - source: this._extension.extensionFolderPath, extensionId: this._extension.id, extensionPointId: this._extensionPointId }); diff --git a/src/vs/workbench/services/extensions/electron-browser/extensionService.ts b/src/vs/workbench/services/extensions/electron-browser/extensionService.ts index 62dcf1eeb5b..6f6e8323b9f 100644 --- a/src/vs/workbench/services/extensions/electron-browser/extensionService.ts +++ b/src/vs/workbench/services/extensions/electron-browser/extensionService.ts @@ -97,11 +97,7 @@ class ExtraBuiltInExtensionResolver implements IExtensionResolver { // Enable to see detailed message communication between window and extension host const logExtensionHostCommunication = false; -function messageWithSource(msg: IMessage): string { - return messageWithSource2(msg.source, msg.message); -} - -function messageWithSource2(source: string, message: string): string { +function messageWithSource(source: string, message: string): string { if (source) { return `[${source}]: ${message}`; } @@ -502,7 +498,7 @@ export class ExtensionService extends Disposable implements IExtensionService { private _getRuntimeExtensions(): TPromise { const log = new Logger((severity, source, message) => { - this._logOrShowMessage(severity, this._isDev ? messageWithSource2(source, message) : message); + this._logOrShowMessage(severity, this._isDev ? messageWithSource(source, message) : message); }); return ExtensionService._scanInstalledExtensions(this._windowService, this._notificationService, this._environmentService, log) @@ -521,7 +517,7 @@ export class ExtensionService extends Disposable implements IExtensionService { user.forEach((userExtension) => { if (result.hasOwnProperty(userExtension.id)) { - log.warn(userExtension.extensionFolderPath, nls.localize('overwritingExtension', "Overwriting extension {0} with {1}.", result[userExtension.id].extensionFolderPath, userExtension.extensionFolderPath)); + log.warn(userExtension.extensionLocation.fsPath, nls.localize('overwritingExtension', "Overwriting extension {0} with {1}.", result[userExtension.id].extensionLocation.fsPath, userExtension.extensionLocation.fsPath)); } if (disabledExtensions.every(disabled => !areSameExtensions(disabled, userExtension))) { // Check if the extension is changed to system extension @@ -535,9 +531,9 @@ export class ExtensionService extends Disposable implements IExtensionService { }); development.forEach(developedExtension => { - log.info('', nls.localize('extensionUnderDevelopment', "Loading development extension at {0}", developedExtension.extensionFolderPath)); + log.info('', nls.localize('extensionUnderDevelopment', "Loading development extension at {0}", developedExtension.extensionLocation.fsPath)); if (result.hasOwnProperty(developedExtension.id)) { - log.warn(developedExtension.extensionFolderPath, nls.localize('overwritingExtension', "Overwriting extension {0} with {1}.", result[developedExtension.id].extensionFolderPath, developedExtension.extensionFolderPath)); + log.warn(developedExtension.extensionLocation.fsPath, nls.localize('overwritingExtension', "Overwriting extension {0} with {1}.", result[developedExtension.id].extensionLocation.fsPath, developedExtension.extensionLocation.fsPath)); } // Do not disable extensions under development result[developedExtension.id] = developedExtension; @@ -598,16 +594,18 @@ export class ExtensionService extends Disposable implements IExtensionService { private _handleExtensionPointMessage(msg: IMessage) { - if (!this._extensionsMessages[msg.source]) { - this._extensionsMessages[msg.source] = []; + if (!this._extensionsMessages[msg.extensionId]) { + this._extensionsMessages[msg.extensionId] = []; } - this._extensionsMessages[msg.source].push(msg); + this._extensionsMessages[msg.extensionId].push(msg); - if (msg.source === this._environmentService.extensionDevelopmentPath) { + const extension = this._registry.getExtensionDescription(msg.extensionId); + const strMsg = `[${msg.extensionId}]: ${msg.message}`; + if (extension && extension.isUnderDevelopment) { // This message is about the extension currently being developed - this._showMessageToUser(msg.type, messageWithSource(msg)); + this._showMessageToUser(msg.type, strMsg); } else { - this._logMessageInConsole(msg.type, messageWithSource(msg)); + this._logMessageInConsole(msg.type, strMsg); } if (!this._isDev && msg.extensionId) { @@ -907,7 +905,6 @@ export class ExtensionService extends Disposable implements IExtensionService { this._extensionsMessages[extensionId].push({ type: severity, message: message, - source: null, extensionId: null, extensionPointId: null }); diff --git a/src/vs/workbench/test/electron-browser/api/extHostMessagerService.test.ts b/src/vs/workbench/test/electron-browser/api/extHostMessagerService.test.ts index 2b536151332..174f1b18ef4 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostMessagerService.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostMessagerService.test.ts @@ -83,7 +83,7 @@ suite('ExtHostMessageService', function () { let service = new MainThreadMessageService(null, new EmptyNotificationService(notification => { assert.equal(notification.actions.primary.length, 1); setImmediate(() => notification.actions.primary[0].run()); - }), emptyCommandService, emptyDialogService, null); + }), emptyCommandService, emptyDialogService); return service.$showMessage(1, 'h', {}, [{ handle: 42, title: 'a thing', isCloseAffordance: true }]).then(handle => { assert.equal(handle, 42); @@ -100,7 +100,7 @@ suite('ExtHostMessageService', function () { assert.equal(buttons[1], 'Cancel'); return Promise.as(0); } - } as IDialogService, null); + } as IDialogService); return service.$showMessage(1, 'h', { modal: true }, [{ handle: 42, title: 'a thing', isCloseAffordance: false }]).then(handle => { assert.equal(handle, 42); @@ -112,7 +112,7 @@ suite('ExtHostMessageService', function () { show(severity, message, buttons) { return Promise.as(1); } - } as IDialogService, null); + } as IDialogService); return service.$showMessage(1, 'h', { modal: true }, [{ handle: 42, title: 'a thing', isCloseAffordance: false }]).then(handle => { assert.equal(handle, undefined); @@ -125,7 +125,7 @@ suite('ExtHostMessageService', function () { assert.equal(buttons.length, 1); return Promise.as(0); } - } as IDialogService, null); + } as IDialogService); return service.$showMessage(1, 'h', { modal: true }, [{ handle: 42, title: 'a thing', isCloseAffordance: true }]).then(handle => { assert.equal(handle, 42);