Skip to content

Commit 19150aa

Browse files
committed
Remove inversify dependency
1 parent 8d8281f commit 19150aa

File tree

8 files changed

+251
-346
lines changed

8 files changed

+251
-346
lines changed

package-lock.json

Lines changed: 242 additions & 290 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,8 @@
594594
"@vscode/python-extension": "^1.0.5",
595595
"fs-extra": "^11.2.0",
596596
"iconv-lite": "^0.6.3",
597-
"inversify": "^6.0.1",
598597
"jsonc-parser": "^3.2.0",
599598
"lodash": "^4.17.21",
600-
"reflect-metadata": "^0.1.13",
601599
"vscode-languageclient": "^8.0.2"
602600
}
603601
}

src/extension/common/promiseUtils.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,3 @@
44
export function ignoreErrors<T>(promise: Promise<T>) {
55
return promise.catch(() => {});
66
}
7-
8-
// if (!String.prototype.format) {
9-
// String.prototype.format = function (this: string) {
10-
// const args = arguments;
11-
// return this.replace(/{(\d+)}/g, (match, number) => (args[number] === undefined ? match : args[number]));
12-
// };
13-
// }

src/extension/debugger/adapter/factory.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
'use strict';
66

7-
import { inject, injectable } from 'inversify';
87
import * as path from 'path';
98
import {
109
DebugAdapterDescriptor,
@@ -31,9 +30,8 @@ export enum debugStateKeys {
3130
doNotShowAgain = 'doNotShowPython36DebugDeprecatedAgain',
3231
}
3332

34-
@injectable()
3533
export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFactory {
36-
constructor(@inject(IPersistentStateFactory) private persistentState: IPersistentStateFactory) {}
34+
constructor(private persistentState: IPersistentStateFactory) {}
3735

3836
public async createDebugAdapterDescriptor(
3937
session: DebugSession,

src/extension/debugger/configuration/debugConfigurationService.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
'use strict';
5-
6-
import { inject, injectable, named } from 'inversify';
74
import { cloneDeep } from 'lodash';
85
import { CancellationToken, DebugConfiguration, QuickPickItem, WorkspaceFolder } from 'vscode';
96
import { DebugConfigStrings } from '../../common/utils/localize';
@@ -21,18 +18,13 @@ import { buildRemoteAttachConfiguration } from './providers/remoteAttach';
2118
import { IDebugConfigurationResolver } from './types';
2219
import { buildFileWithArgsLaunchDebugConfiguration } from './providers/fileLaunchWithArgs';
2320

24-
@injectable()
2521
export class PythonDebugConfigurationService implements IDebugConfigurationService {
2622
private cacheDebugConfig: DebugConfiguration | undefined = undefined;
2723

2824
constructor(
29-
@inject(IDebugConfigurationResolver)
30-
@named('attach')
3125
private readonly attachResolver: IDebugConfigurationResolver<AttachRequestArguments>,
32-
@inject(IDebugConfigurationResolver)
33-
@named('launch')
3426
private readonly launchResolver: IDebugConfigurationResolver<LaunchRequestArguments>,
35-
@inject(IMultiStepInputFactory) private readonly multiStepFactory: IMultiStepInputFactory,
27+
private readonly multiStepFactory: IMultiStepInputFactory,
3628
) {}
3729

3830
public async provideDebugConfigurations(

src/extension/debugger/hooks/childProcessAttachHandler.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
'use strict';
5-
6-
import { inject, injectable } from 'inversify';
74
import { DebugConfiguration, DebugSessionCustomEvent } from 'vscode';
85
import { swallowExceptions } from '../../common/utils/decorators';
96
import { AttachRequestArguments } from '../../types';
@@ -18,11 +15,9 @@ import { DebuggerTypeName } from '../../constants';
1815
* @class ChildProcessAttachEventHandler
1916
* @implements {IDebugSessionEventHandlers}
2017
*/
21-
@injectable()
18+
2219
export class ChildProcessAttachEventHandler implements IDebugSessionEventHandlers {
23-
constructor(
24-
@inject(IChildProcessAttachService) private readonly childProcessAttachService: IChildProcessAttachService,
25-
) {}
20+
constructor(private readonly childProcessAttachService: IChildProcessAttachService) {}
2621

2722
@swallowExceptions('Handle child process launch')
2823
public async handleCustomEvent(event: DebugSessionCustomEvent): Promise<void> {

src/extension/debugger/hooks/debugpySocketsHandler.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
'use strict';
55

6-
import { inject, injectable } from 'inversify';
76
import { DebugSessionCustomEvent } from 'vscode';
87
import { swallowExceptions } from '../../common/utils/decorators';
98
import { DebuggerEvents } from './constants';
@@ -18,11 +17,8 @@ import { traceLog } from '../../common/log/logging';
1817
* @class ChildProcessAttachEventHandler
1918
* @implements {IDebugSessionEventHandlers}
2019
*/
21-
@injectable()
2220
export class DebugpySocketsHandler implements IDebugSessionEventHandlers {
23-
constructor(
24-
@inject(DebugPortAttributesProvider) private readonly debugPortAttributesProvider: DebugPortAttributesProvider,
25-
) {}
21+
constructor(private readonly debugPortAttributesProvider: DebugPortAttributesProvider) {}
2622

2723
@swallowExceptions('Handle child process launch')
2824
public async handleCustomEvent(event: DebugSessionCustomEvent): Promise<void> {

src/extension/extension.ts

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,25 @@
11
'use strict';
22

3-
// import * as vscode from 'vscode';
4-
5-
// This line should always be right on top.
6-
7-
if ((Reflect as any).metadata === undefined) {
8-
require('reflect-metadata');
9-
}
10-
113
import { registerDebugger } from './extensionInit';
124
import { IExtensionContext } from './common/types';
135
import { createOutputChannel, registerCommand } from './common/vscodeapi';
146
import { Commands } from './common/constants';
15-
import { registerLogger, traceError, traceLog } from './common/log/logging';
7+
import { registerLogger, traceError } from './common/log/logging';
168
import { sendTelemetryEvent } from './telemetry';
179
import { EventName } from './telemetry/constants';
1810
import { IExtensionApi } from './apiTypes';
1911

20-
// this method is called when your extension is activated
21-
// your extension is activated the very first time the command is executed
22-
export async function activate(context: IExtensionContext): Promise<IExtensionApi> {
23-
let api: IExtensionApi;
24-
// Setup logging
12+
export async function activate(context: IExtensionContext): Promise<IExtensionApi | undefined> {
2513
const outputChannel = createOutputChannel('Python Debugger');
2614
context.subscriptions.push(outputChannel, registerLogger(outputChannel));
2715
context.subscriptions.push(registerCommand(Commands.ViewOutput, () => outputChannel.show()));
2816

29-
traceLog(`Name: Python Debugger`);
30-
traceLog(`Module: debugpy`);
31-
3217
try {
33-
api = await registerDebugger(context);
18+
const api = await registerDebugger(context);
3419
sendTelemetryEvent(EventName.DEBUG_SUCCESS_ACTIVATION);
20+
return api;
3521
} catch (ex) {
3622
traceError('sendDebugpySuccessActivationTelemetry() failed.', ex);
3723
throw ex; // re-raise
3824
}
39-
40-
return api;
4125
}
42-
43-
// this method is called when your extension is deactivated
44-
export function deactivate() {}

0 commit comments

Comments
 (0)