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