Skip to content

Commit bdd9a4b

Browse files
author
Kartik Raj
authored
Fix poetry discovery (#20181)
1 parent 5bfc6d5 commit bdd9a4b

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/client/extensionActivation.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ import { registerTypes as tensorBoardRegisterTypes } from './tensorBoard/service
4646
import { registerTypes as commonRegisterTerminalTypes } from './terminals/serviceRegistry';
4747
import { ICodeExecutionManager, ITerminalAutoActivation } from './terminals/types';
4848
import { registerTypes as unitTestsRegisterTypes } from './testing/serviceRegistry';
49-
import { registerTypes as interpretersRegisterTypes } from './interpreter/serviceRegistry';
5049

5150
// components
5251
import * as pythonEnvironments from './pythonEnvironments';
@@ -131,7 +130,6 @@ async function activateLegacy(ext: ExtensionState): Promise<ActivationResult> {
131130
// Feature specific registrations.
132131
unitTestsRegisterTypes(serviceManager);
133132
lintersRegisterTypes(serviceManager);
134-
interpretersRegisterTypes(serviceManager);
135133
formattersRegisterTypes(serviceManager);
136134
installerRegisterTypes(serviceManager);
137135
commonRegisterTerminalTypes(serviceManager);

src/client/extensionInit.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { STANDARD_OUTPUT_CHANNEL } from './common/constants';
1010
import { registerTypes as platformRegisterTypes } from './common/platform/serviceRegistry';
1111
import { registerTypes as processRegisterTypes } from './common/process/serviceRegistry';
1212
import { registerTypes as commonRegisterTypes } from './common/serviceRegistry';
13+
import { registerTypes as interpretersRegisterTypes } from './interpreter/serviceRegistry';
1314
import {
1415
GLOBAL_MEMENTO,
1516
IDisposableRegistry,
@@ -85,6 +86,7 @@ export function initializeStandard(ext: ExtensionState): void {
8586
variableRegisterTypes(serviceManager);
8687
platformRegisterTypes(serviceManager);
8788
processRegisterTypes(serviceManager);
89+
interpretersRegisterTypes(serviceManager);
8890

8991
// We will be pulling other code over from activateLegacy().
9092
}

src/client/pythonEnvironments/common/environmentManagers/poetry.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,14 @@ export class Poetry {
142142
traceVerbose(`Getting poetry for cwd ${cwd}`);
143143
// Produce a list of candidate binaries to be probed by exec'ing them.
144144
function* getCandidates() {
145-
const customPoetryPath = getPythonSetting<string>('poetryPath');
146-
if (customPoetryPath && customPoetryPath !== 'poetry') {
147-
// If user has specified a custom poetry path, use it first.
148-
yield customPoetryPath;
145+
try {
146+
const customPoetryPath = getPythonSetting<string>('poetryPath');
147+
if (customPoetryPath && customPoetryPath !== 'poetry') {
148+
// If user has specified a custom poetry path, use it first.
149+
yield customPoetryPath;
150+
}
151+
} catch (ex) {
152+
traceError(`Failed to get poetry setting`, ex);
149153
}
150154
// Check unqualified filename, in case it's on PATH.
151155
yield 'poetry';

0 commit comments

Comments
 (0)