Merge from vscode a4177f50c475fc0fa278a78235e3bee9ffdec781 (#8649)

* Merge from vscode a4177f50c475fc0fa278a78235e3bee9ffdec781

* distro

* fix tests
This commit is contained in:
Anthony Dresser
2019-12-11 22:42:23 -08:00
committed by GitHub
parent 82974a2135
commit 4ba6a979ba
280 changed files with 10898 additions and 14231 deletions

View File

@@ -36,9 +36,12 @@ import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'
import { parseExtensionDevOptions } from '../common/extensionDevOptions';
import { VSBuffer } from 'vs/base/common/buffer';
import { IExtensionHostDebugService } from 'vs/platform/debug/common/extensionHostDebug';
import { IExtensionHostStarter } from 'vs/workbench/services/extensions/common/extensions';
import { IExtensionHostStarter, ExtensionHostLogFileName } from 'vs/workbench/services/extensions/common/extensions';
import { isUntitledWorkspace } from 'vs/platform/workspaces/common/workspaces';
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { joinPath } from 'vs/base/common/resources';
import { Registry } from 'vs/platform/registry/common/platform';
import { IOutputChannelRegistry, Extensions } from 'vs/workbench/services/output/common/output';
export class ExtensionHostProcessWorker implements IExtensionHostStarter {
@@ -65,6 +68,8 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter {
private _extensionHostConnection: Socket | null;
private _messageProtocol: Promise<PersistentProtocol> | null;
private readonly _extensionHostLogFile: URI;
constructor(
private readonly _autoStart: boolean,
private readonly _extensions: Promise<IExtensionDescription[]>,
@@ -95,6 +100,8 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter {
this._extensionHostConnection = null;
this._messageProtocol = null;
this._extensionHostLogFile = joinPath(this._extensionHostLogsLocation, `${ExtensionHostLogFileName}.log`);
this._toDispose.add(this._onExit);
this._toDispose.add(this._lifecycleService.onWillShutdown(e => this._onWillShutdown(e)));
this._toDispose.add(this._lifecycleService.onShutdown(reason => this.terminate()));
@@ -112,7 +119,7 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter {
const globalExitListener = () => this.terminate();
process.once('exit', globalExitListener);
this._toDispose.add(toDisposable(() => {
process.removeListener('exit', globalExitListener);
process.removeListener('exit' as 'loaded', globalExitListener); // https://github.com/electron/electron/issues/21475
}));
}
@@ -373,6 +380,9 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter {
// stop listening for messages here
disposable.dispose();
// Register log channel for exthost log
Registry.as<IOutputChannelRegistry>(Extensions.OutputChannels).registerChannel({ id: 'extHostLog', label: nls.localize('extension host Log', "Extension Host"), file: this._extensionHostLogFile, log: true });
// release this promise
resolve(protocol);
return;
@@ -425,6 +435,7 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter {
telemetryInfo,
logLevel: this._logService.getLevel(),
logsLocation: this._extensionHostLogsLocation,
logFile: this._extensionHostLogFile,
autoStart: this._autoStart,
uiKind: UIKind.Desktop
};

View File

@@ -10,6 +10,7 @@ import { IExtensionHostProfile, IExtensionService, ProfileSegmentId, ProfileSess
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { withNullAsUndefined } from 'vs/base/common/types';
import { Schemas } from 'vs/base/common/network';
import { URI } from 'vs/base/common/uri';
export class ExtensionHostProfiler {
@@ -32,7 +33,7 @@ export class ExtensionHostProfiler {
let searchTree = TernarySearchTree.forPaths<IExtensionDescription>();
for (let extension of extensions) {
if (extension.extensionLocation.scheme === Schemas.file) {
searchTree.set(realpathSync(extension.extensionLocation.fsPath), extension);
searchTree.set(URI.file(realpathSync(extension.extensionLocation.fsPath)).toString(), extension);
}
}
@@ -59,7 +60,12 @@ export class ExtensionHostProfiler {
break;
}
} else if (segmentId === 'self' && node.callFrame.url) {
let extension = searchTree.findSubstr(node.callFrame.url);
let extension: IExtensionDescription | undefined;
try {
extension = searchTree.findSubstr(URI.parse(node.callFrame.url).toString());
} catch {
// ignore
}
if (extension) {
segmentId = extension.identifier.value;
}