Skip to content

Commit 2b8d827

Browse files
Remove interpreter version validation
1 parent f9725af commit 2b8d827

File tree

4 files changed

+39
-43
lines changed

4 files changed

+39
-43
lines changed

src/extension/debugger/adapter/factory.ts

Lines changed: 35 additions & 39 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() {}
3735

3836
public async createDebugAdapterDescriptor(
3937
session: DebugSession,
@@ -140,45 +138,43 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac
140138
return [];
141139
}
142140

143-
private async showDeprecatedPythonMessage() {
144-
const notificationPromptEnabled = this.persistentState.createGlobalPersistentState(
145-
debugStateKeys.doNotShowAgain,
146-
false,
147-
);
148-
if (notificationPromptEnabled.value) {
149-
return;
150-
}
151-
const prompts = [Interpreters.changePythonInterpreter, Common.doNotShowAgain];
152-
const selection = await showErrorMessage(
153-
l10n.t('The debugger in the python extension no longer supports python versions minor than 3.7.'),
154-
{ modal: true },
155-
...prompts,
156-
);
157-
if (!selection) {
158-
return;
159-
}
160-
if (selection === Interpreters.changePythonInterpreter) {
161-
await runPythonExtensionCommand(Commands.Set_Interpreter);
162-
}
163-
if (selection === Common.doNotShowAgain) {
164-
// Never show the message again
165-
await this.persistentState
166-
.createGlobalPersistentState(debugStateKeys.doNotShowAgain, false)
167-
.updateValue(true);
168-
}
169-
}
141+
// private async showDeprecatedPythonMessage() {
142+
// const notificationPromptEnabled = this.persistentState.createGlobalPersistentState(
143+
// debugStateKeys.doNotShowAgain,
144+
// false,
145+
// );
146+
// if (notificationPromptEnabled.value) {
147+
// return;
148+
// }
149+
// const prompts = [Interpreters.changePythonInterpreter, Common.doNotShowAgain];
150+
// const selection = await showErrorMessage(
151+
// l10n.t('The debugger in the python extension no longer supports python versions minor than 3.7.'),
152+
// { modal: true },
153+
// ...prompts,
154+
// );
155+
// if (!selection) {
156+
// return;
157+
// }
158+
// if (selection === Interpreters.changePythonInterpreter) {
159+
// await runPythonExtensionCommand(Commands.Set_Interpreter);
160+
// }
161+
// if (selection === Common.doNotShowAgain) {
162+
// // Never show the message again
163+
// await this.persistentState
164+
// .createGlobalPersistentState(debugStateKeys.doNotShowAgain, false)
165+
// .updateValue(true);
166+
// }
167+
// }
170168

171169
private async getExecutableCommand(interpreter: Environment | undefined): Promise<string[]> {
172-
const debugpyVersionPath = path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'get_debugpy_version.py');
173-
174-
175170
if (interpreter) {
176-
if (
177-
(interpreter.version?.major ?? 0) < 3 ||
178-
((interpreter.version?.major ?? 0) <= 3 && (interpreter.version?.minor ?? 0) <= 6)
179-
) {
180-
this.showDeprecatedPythonMessage();
181-
}
171+
// This is going to be implemented later, in order to check the debugpy version
172+
// if (
173+
// (interpreter.version?.major ?? 0) < 3 ||
174+
// ((interpreter.version?.major ?? 0) <= 3 && (interpreter.version?.minor ?? 0) <= 6)
175+
// ) {
176+
// this.showDeprecatedPythonMessage();
177+
// }
182178
return interpreter.path.length > 0 ? [interpreter.path] : [];
183179
}
184180
return [];

src/extension/extensionInit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export async function registerDebugger(context: IExtensionContext): Promise<void
8686
}),
8787
);
8888

89-
const debugAdapterDescriptorFactory = new DebugAdapterDescriptorFactory(persistantState);
89+
const debugAdapterDescriptorFactory = new DebugAdapterDescriptorFactory();
9090
const debugSessionLoggingFactory = new DebugSessionLoggingFactory();
9191
const debuggerPromptFactory = new OutdatedDebuggerPromptFactory();
9292
context.subscriptions.push(debug.registerDebugAdapterTrackerFactory(DebuggerTypeName, debugSessionLoggingFactory));

src/test/unittest/adapter/factory.unit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ suite('Debugging - Adapter Factory', () => {
8080

8181
getInterpretersStub.returns([interpreter]);
8282
hasInterpretersStub.returns(true);
83-
factory = new DebugAdapterDescriptorFactory(instance(stateFactory));
83+
factory = new DebugAdapterDescriptorFactory();
8484
});
8585

8686
teardown(() => {
@@ -137,7 +137,7 @@ suite('Debugging - Adapter Factory', () => {
137137
sinon.assert.calledOnce(showErrorMessageStub);
138138
});
139139

140-
test('Display a message if python version is less than 3.7', async () => {
140+
test.skip('Display a message if python version is less than 3.7', async () => {
141141
getInterpretersStub.returns([]);
142142
const session = createSession({});
143143
const deprecatedInterpreter = {

src/test/unittest/extensionInit.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ suite('Debugging - register Debugging', () => {
4949
completionProvider = new LaunchJsonCompletionProvider();
5050
persistantState = new PersistentStateFactory(context.object.globalState, context.object.workspaceState);
5151
registerCompletionItemProviderStub = sinon.stub(vscode.languages, 'registerCompletionItemProvider');
52-
descriptorFactory = new DebugAdapterDescriptorFactory(persistantState);
52+
descriptorFactory = new DebugAdapterDescriptorFactory();
5353
context.setup((c) => c.subscriptions).returns(() => []);
5454
});
5555
teardown(() => {

0 commit comments

Comments
 (0)