Skip to content

Commit

Permalink
move mainThreadConsole, #70319
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Mar 20, 2019
1 parent 2f157c7 commit cffe0d6
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { MainContext, MainThreadConsoleShape, IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IRemoteConsoleLog, log, parse } from 'vs/base/common/console';
import { parseExtensionDevOptions } from 'vs/workbench/services/extensions/electron-browser/extensionHost';
import { parseExtensionDevOptions } from 'vs/workbench/services/extensions/common/extensionDevOptions';
import { IWindowsService } from 'vs/platform/windows/common/windows';
import { IBroadcastService } from 'vs/workbench/services/broadcast/common/broadcast';
import { EXTENSION_LOG_BROADCAST_CHANNEL } from 'vs/platform/extensions/common/extensionHost';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { LanguageConfigurationFileHandler } from 'vs/workbench/contrib/codeEdito
import '../browser/mainThreadClipboard';
import '../browser/mainThreadCommands';
import '../browser/mainThreadConfiguration';
import '../browser/mainThreadConsole';
import '../browser/mainThreadDebugService';
import '../browser/mainThreadDecorations';
import '../browser/mainThreadDiagnostics';
Expand All @@ -27,11 +28,12 @@ import '../browser/mainThreadDocumentsAndEditors';
import '../browser/mainThreadEditor';
import '../browser/mainThreadEditors';
import '../browser/mainThreadErrors';
import '../browser/mainThreadExtensionService';
import '../browser/mainThreadFileSystem';
import '../browser/mainThreadFileSystemEventService';
import '../browser/mainThreadHeapService';
import '../browser/mainThreadLanguages';
import '../browser/mainThreadLanguageFeatures';
import '../browser/mainThreadLanguages';
import '../browser/mainThreadLogService';
import '../browser/mainThreadMessageService';
import '../browser/mainThreadOutputService';
Expand All @@ -49,8 +51,6 @@ import '../browser/mainThreadUrls';
import '../browser/mainThreadWindow';
import '../browser/mainThreadWorkspace';
import './mainThreadComments';
import './mainThreadConsole';
import '../browser/mainThreadExtensionService';
import './mainThreadTask';
import './mainThreadWebview';
import 'vs/workbench/api/node/apiCommands';
Expand Down
30 changes: 30 additions & 0 deletions src/vs/workbench/services/extensions/common/extensionDevOptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { Schemas } from 'vs/base/common/network';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';

export interface IExtensionDevOptions {
readonly isExtensionDevHost: boolean;
readonly isExtensionDevDebug: boolean;
readonly isExtensionDevDebugBrk: boolean;
readonly isExtensionDevTestFromCli: boolean;
}

export function parseExtensionDevOptions(environmentService: IEnvironmentService): IExtensionDevOptions {
// handle extension host lifecycle a bit special when we know we are developing an extension that runs inside
let isExtensionDevHost = environmentService.isExtensionDevelopment;
const extDevLoc = environmentService.extensionDevelopmentLocationURI;
const debugOk = !extDevLoc || extDevLoc.scheme === Schemas.file;
let isExtensionDevDebug = debugOk && typeof environmentService.debugExtensionHost.port === 'number';
let isExtensionDevDebugBrk = debugOk && !!environmentService.debugExtensionHost.break;
let isExtensionDevTestFromCli = isExtensionDevHost && !!environmentService.extensionTestsLocationURI && !environmentService.debugExtensionHost.break;
return {
isExtensionDevHost,
isExtensionDevDebug,
isExtensionDevDebugBrk,
isExtensionDevTestFromCli,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { timeout } from 'vs/base/common/async';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { Emitter, Event } from 'vs/base/common/event';
import { IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle';
import { Schemas } from 'vs/base/common/network';
import * as objects from 'vs/base/common/objects';
import { isWindows } from 'vs/base/common/platform';
import { isEqual } from 'vs/base/common/resources';
Expand All @@ -36,6 +35,7 @@ import { IInitData } from 'vs/workbench/api/common/extHost.protocol';
import { MessageType, createMessageOfType, isMessageOfType } from 'vs/workbench/services/extensions/node/extensionHostProtocol';
import { withNullAsUndefined } from 'vs/base/common/types';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { parseExtensionDevOptions } from '../common/extensionDevOptions';

export interface IExtensionHostStarter {
readonly onCrashed: Event<[number, string | null]>;
Expand All @@ -44,28 +44,6 @@ export interface IExtensionHostStarter {
dispose(): void;
}

export interface IExtensionDevOptions {
readonly isExtensionDevHost: boolean;
readonly isExtensionDevDebug: boolean;
readonly isExtensionDevDebugBrk: boolean;
readonly isExtensionDevTestFromCli: boolean;
}
export function parseExtensionDevOptions(environmentService: IEnvironmentService): IExtensionDevOptions {
// handle extension host lifecycle a bit special when we know we are developing an extension that runs inside
let isExtensionDevHost = environmentService.isExtensionDevelopment;
const extDevLoc = environmentService.extensionDevelopmentLocationURI;
const debugOk = !extDevLoc || extDevLoc.scheme === Schemas.file;
let isExtensionDevDebug = debugOk && typeof environmentService.debugExtensionHost.port === 'number';
let isExtensionDevDebugBrk = debugOk && !!environmentService.debugExtensionHost.break;
let isExtensionDevTestFromCli = isExtensionDevHost && !!environmentService.extensionTestsLocationURI && !environmentService.debugExtensionHost.break;
return {
isExtensionDevHost,
isExtensionDevDebug,
isExtensionDevDebugBrk,
isExtensionDevTestFromCli,
};
}

export class ExtensionHostProcessWorker implements IExtensionHostStarter {

private readonly _onCrashed: Emitter<[number, string]> = new Emitter<[number, string]>();
Expand Down

0 comments on commit cffe0d6

Please sign in to comment.