|
| 1 | +import { EventEmitter, MarkdownString } from 'vscode'; |
| 2 | +import { |
| 3 | + CreateEnvironmentOptions, |
| 4 | + CreateEnvironmentScope, |
| 5 | + DidChangeEnvironmentEventArgs, |
| 6 | + DidChangeEnvironmentsEventArgs, |
| 7 | + EnvironmentManager, |
| 8 | + GetEnvironmentScope, |
| 9 | + GetEnvironmentsScope, |
| 10 | + IconPath, |
| 11 | + PythonEnvironment, |
| 12 | + PythonEnvironmentApi, |
| 13 | + QuickCreateConfig, |
| 14 | + RefreshEnvironmentsScope, |
| 15 | + ResolveEnvironmentContext, |
| 16 | + SetEnvironmentScope, |
| 17 | +} from '../../api'; |
| 18 | +import { PipenvStrings } from '../../common/localize'; |
| 19 | +import { NativePythonFinder } from '../common/nativePythonFinder'; |
| 20 | + |
| 21 | +export class PipenvManager implements EnvironmentManager { |
| 22 | + private collection: PythonEnvironment[] = []; |
| 23 | + private fsPathToEnv: Map<string, PythonEnvironment> = new Map(); |
| 24 | + private globalEnv: PythonEnvironment | undefined; |
| 25 | + |
| 26 | + private readonly _onDidChangeEnvironment = new EventEmitter<DidChangeEnvironmentEventArgs>(); |
| 27 | + public readonly onDidChangeEnvironment = this._onDidChangeEnvironment.event; |
| 28 | + |
| 29 | + private readonly _onDidChangeEnvironments = new EventEmitter<DidChangeEnvironmentsEventArgs>(); |
| 30 | + public readonly onDidChangeEnvironments = this._onDidChangeEnvironments.event; |
| 31 | + constructor(private readonly nativeFinder: NativePythonFinder, private readonly api: PythonEnvironmentApi) { |
| 32 | + this.name = 'pipenv'; |
| 33 | + this.displayName = 'Pipenv'; |
| 34 | + this.preferredPackageManagerId = 'ms-python.python:pip'; |
| 35 | + this.tooltip = new MarkdownString(PipenvStrings.pipenvManager, true); |
| 36 | + } |
| 37 | + |
| 38 | + name: string; |
| 39 | + displayName: string; |
| 40 | + preferredPackageManagerId: string; |
| 41 | + description?: string; |
| 42 | + tooltip: string | MarkdownString; |
| 43 | + iconPath?: IconPath; |
| 44 | + |
| 45 | + public dispose() { |
| 46 | + this.collection = []; |
| 47 | + this.fsPathToEnv.clear(); |
| 48 | + } |
| 49 | + |
| 50 | + quickCreateConfig?(): QuickCreateConfig | undefined { |
| 51 | + // To be implemented |
| 52 | + return undefined; |
| 53 | + } |
| 54 | + |
| 55 | + async create?( |
| 56 | + _scope: CreateEnvironmentScope, |
| 57 | + _options?: CreateEnvironmentOptions, |
| 58 | + ): Promise<PythonEnvironment | undefined> { |
| 59 | + // To be implemented |
| 60 | + return undefined; |
| 61 | + } |
| 62 | + |
| 63 | + async remove?(_environment: PythonEnvironment): Promise<void> { |
| 64 | + // To be implemented |
| 65 | + } |
| 66 | + |
| 67 | + async refresh(_scope: RefreshEnvironmentsScope): Promise<void> { |
| 68 | + // To be implemented |
| 69 | + } |
| 70 | + |
| 71 | + async getEnvironments(_scope: GetEnvironmentsScope): Promise<PythonEnvironment[]> { |
| 72 | + // To be implemented |
| 73 | + return []; |
| 74 | + } |
| 75 | + |
| 76 | + async set(_scope: SetEnvironmentScope, _environment?: PythonEnvironment): Promise<void> { |
| 77 | + // To be implemented |
| 78 | + } |
| 79 | + |
| 80 | + async get(_scope: GetEnvironmentScope): Promise<PythonEnvironment | undefined> { |
| 81 | + // To be implemented |
| 82 | + return undefined; |
| 83 | + } |
| 84 | + |
| 85 | + async resolve(_context: ResolveEnvironmentContext): Promise<PythonEnvironment | undefined> { |
| 86 | + // To be implemented |
| 87 | + return undefined; |
| 88 | + } |
| 89 | + |
| 90 | + async clearCache?(): Promise<void> { |
| 91 | + // To be implemented |
| 92 | + } |
| 93 | +} |
0 commit comments