Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/managers/pipenv/pipenvUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ export async function clearPipenvCache(): Promise<void> {
pipenvPath = undefined;
}

function getPipenvPathFromSettings(): Uri[] {
function getPipenvPathFromSettings(): string | undefined {
const pipenvPath = getSettingWorkspaceScope<string>('python', 'pipenvPath');
return pipenvPath ? [Uri.file(pipenvPath)] : [];
return pipenvPath ? pipenvPath : undefined;
}

export async function getPipenv(native?: NativePythonFinder): Promise<string | undefined> {
Expand All @@ -64,6 +64,14 @@ export async function getPipenv(native?: NativePythonFinder): Promise<string | u
return pipenvPath;
}

// try to get from settings
const settingPath = getPipenvPathFromSettings();
if (settingPath) {
pipenvPath = settingPath;
traceInfo(`Using pipenv from settings: ${settingPath}`);
return pipenvPath;
}

// Try to find pipenv in PATH
const foundPipenv = await findPipenv();
if (foundPipenv) {
Expand Down Expand Up @@ -147,8 +155,8 @@ export async function refreshPipenv(
): Promise<PythonEnvironment[]> {
traceInfo('Refreshing pipenv environments');

const searchUris = getPipenvPathFromSettings();
const data = await nativeFinder.refresh(hardRefresh, searchUris.length > 0 ? searchUris : undefined);
const searchPath = getPipenvPathFromSettings();
const data = await nativeFinder.refresh(hardRefresh, searchPath ? [Uri.file(searchPath)] : undefined);

let pipenv = await getPipenv();

Expand Down
Loading