Skip to content
Draft
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
13 changes: 8 additions & 5 deletions src/hatch-env-manager.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { homedir } from 'node:os'
import paths from 'node:path'
import {
EventEmitter,
Expand Down Expand Up @@ -344,7 +345,7 @@ export class HatchEnvManager implements EnvironmentManager {
}

#hatch2pythonEnv(
executable: string,
hatchBin: string,
{ name, path, conf, projectPath }: HatchEnvInfo,
): HatchEnvironment {
const shellActivation: Map<string, PythonCommandRunConfiguration[]> =
Expand All @@ -353,21 +354,23 @@ export class HatchEnvManager implements EnvironmentManager {
new Map()

shellActivation.set('unknown', [
{ executable, args: [`--env=${name}`, 'shell'] },
{ executable: hatchBin, args: [`--env=${name}`, 'shell'] },
])
shellDeactivation.set('unknown', [{ executable: 'exit' }])

const pyBin = envBin(path, 'python')

const envInfo: PythonEnvironmentInfo = {
name,
description: conf.description,
displayName: name,
displayPath: path,
displayPath: path.replace(homedir(), '~'),
tooltip: path,
environmentPath: Uri.file(path),
environmentPath: Uri.file(pyBin),
sysPrefix: path,
version: '1', // TODO
execInfo: {
run: { executable: envBin(path, 'python') },
run: { executable: pyBin },
shellActivation,
shellDeactivation,
},
Expand Down