forked from microsoft/vscode-node-debug2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnodeDebug.ts
More file actions
64 lines (56 loc) · 3.41 KB
/
Copy pathnodeDebug.ts
File metadata and controls
64 lines (56 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import { ChromeDebugSession, logger, telemetry, OnlyProvideCustomLauncherExtensibilityPoints, interfaces, GetComponentByID, DependencyInjection, TYPES, UninitializedCDA } from 'vscode-chrome-debug-core';
import * as path from 'path';
import * as os from 'os';
import { NodeLauncher } from './launcherAndRuner/nodeLauncher';
import { NodeRunner } from './launcherAndRuner/nodeRunner';
import { NewNodeDebugAdapter } from './components/nodeDebugAdapter';
import { NodeDebugAdapterConfigurerService } from './components/nodeDebugAdapterConfigurerService';
import { CustomizedUninitializedCDA } from './components/customizedUninitializedCDA';
import { FakeNodeVersionProvider } from './components/fakeNodeVersionProvider';
import { FakeLogEventsProvider } from './components/fakeLogEventsProvider';
import { FakeDOMInstrumentationBreakpointsSetter } from './components/fakeDOMInstrumentationBreakpointsSetter';
import { PauseOnStartHandler } from './components/pauseOnStartHandler';
import { NodeInitializer } from './launcherAndRuner/nodeInitializer';
function customizeComponents<T>(identifier: interfaces.ServiceIdentifier<T>, component: T, getComponentById: GetComponentByID): T {
switch (identifier) {
case TYPES.UninitializedCDA:
// We use our own version of the UninitializedCDA component to declare some extra capabilities that this client supports
return <T><unknown>new CustomizedUninitializedCDA(
getComponentById(TYPES.ISession),
<UninitializedCDA><unknown>component);
default:
return component;
}
}
const logFilePath = path.join(os.tmpdir(), 'vscode-node-debug2.txt'); // non-.txt file types can't be uploaded to github
const extensibilityPoints = new OnlyProvideCustomLauncherExtensibilityPoints(logFilePath, NodeLauncher, NodeRunner, customizeComponents, NodeInitializer);
extensibilityPoints.bindAdditionalComponents = (diContainer: DependencyInjection) => {
diContainer.configureClass(TYPES.IServiceComponent, NodeDebugAdapterConfigurerService);
diContainer.configureClass(TYPES.IServiceComponent, PauseOnStartHandler);
// Services not supported on node
diContainer.unconfigure(TYPES.IDebuggeeRuntimeVersionProvider);
diContainer.configureClass(TYPES.IDebuggeeRuntimeVersionProvider, FakeNodeVersionProvider);
diContainer.unconfigure(TYPES.ILogEventsProvider);
diContainer.configureClass(TYPES.ILogEventsProvider, FakeLogEventsProvider);
diContainer.unconfigure(TYPES.IDOMInstrumentationBreakpointsSetter);
diContainer.configureClass(TYPES.IDOMInstrumentationBreakpointsSetter, FakeDOMInstrumentationBreakpointsSetter);
};
ChromeDebugSession.run(ChromeDebugSession.getSession(
{
logFilePath: logFilePath,
adapter: NewNodeDebugAdapter,
extensionName: 'node-debug2',
extensibilityPoints: extensibilityPoints
}));
/* tslint:disable:no-var-requires */
const debugAdapterVersion = require('../../package.json').version;
logger.log('node-debug2: ' + debugAdapterVersion);
/* __GDPR__FRAGMENT__
"DebugCommonProperties" : {
"Versions.DebugAdapter" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
telemetry.telemetry.addCustomGlobalProperty({ 'Versions.DebugAdapter': debugAdapterVersion });