forked from microsoft/vscode-python-environments
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsampleEnvManager.ts
More file actions
95 lines (77 loc) · 3.44 KB
/
sampleEnvManager.ts
File metadata and controls
95 lines (77 loc) · 3.44 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
94
95
import { MarkdownString, LogOutputChannel, Event } from 'vscode';
import {
CreateEnvironmentOptions,
CreateEnvironmentScope,
DidChangeEnvironmentEventArgs,
DidChangeEnvironmentsEventArgs,
EnvironmentManager,
GetEnvironmentScope,
GetEnvironmentsScope,
IconPath,
PythonEnvironment,
QuickCreateConfig,
RefreshEnvironmentsScope,
ResolveEnvironmentContext,
SetEnvironmentScope,
} from './api';
export class SampleEnvManager implements EnvironmentManager {
name: string;
displayName?: string | undefined;
preferredPackageManagerId: string;
description?: string | undefined;
tooltip?: string | MarkdownString | undefined;
iconPath?: IconPath | undefined;
log?: LogOutputChannel | undefined;
constructor(log: LogOutputChannel) {
this.name = 'sample';
this.displayName = 'Sample';
this.preferredPackageManagerId = 'my-publisher.sample:sample';
// if you want to use builtin `pip` then use this
// this.preferredPackageManagerId = 'ms-python.python:pip';
this.log = log;
}
quickCreateConfig(): QuickCreateConfig | undefined {
// Code to provide quick create configuration goes here
throw new Error('Method not implemented.');
}
create?(scope: CreateEnvironmentScope, options?: CreateEnvironmentOptions): Promise<PythonEnvironment | undefined> {
// Code to handle creating environments goes here
throw new Error('Method not implemented.');
}
remove?(environment: PythonEnvironment): Promise<void> {
// Code to handle removing environments goes here
throw new Error('Method not implemented.');
}
refresh(scope: RefreshEnvironmentsScope): Promise<void> {
// Code to handle refreshing environments goes here
// This is called when the user clicks on the refresh button in the UI
throw new Error('Method not implemented.');
}
getEnvironments(scope: GetEnvironmentsScope): Promise<PythonEnvironment[]> {
// Code to get the list of environments goes here
// This may be called when the python extension is activated to get the list of environments
throw new Error('Method not implemented.');
}
// Event to be raised with the list of available extensions changes for this manager
onDidChangeEnvironments?: Event<DidChangeEnvironmentsEventArgs> | undefined;
set(scope: SetEnvironmentScope, environment?: PythonEnvironment): Promise<void> {
// User selected a environment for the given scope
// undefined environment means user wants to reset the environment for the given scope
throw new Error('Method not implemented.');
}
get(scope: GetEnvironmentScope): Promise<PythonEnvironment | undefined> {
// Code to get the environment for the given scope goes here
throw new Error('Method not implemented.');
}
// Event to be raised when the environment for any active scope changes
onDidChangeEnvironment?: Event<DidChangeEnvironmentEventArgs> | undefined;
resolve(context: ResolveEnvironmentContext): Promise<PythonEnvironment | undefined> {
// Code to resolve the environment goes here. Resolving an environment means
// to convert paths to actual environments
throw new Error('Method not implemented.');
}
clearCache?(): Promise<void> {
// Code to clear any cached data goes here
throw new Error('Method not implemented.');
}
}