-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathmain.ts
More file actions
27 lines (24 loc) · 965 Bytes
/
main.ts
File metadata and controls
27 lines (24 loc) · 965 Bytes
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
import { Disposable } from 'vscode';
import { PythonEnvironmentApi } from '../../api';
import { traceInfo } from '../../common/logging';
import { getPythonApi } from '../../features/pythonApi';
import { NativePythonFinder } from '../common/nativePythonFinder';
import { PyEnvManager } from './pyenvManager';
import { getPyenv } from './pyenvUtils';
export async function registerPyenvFeatures(
nativeFinder: NativePythonFinder,
disposables: Disposable[],
): Promise<void> {
const api: PythonEnvironmentApi = await getPythonApi();
try {
const pyenv = await getPyenv(nativeFinder);
if (pyenv) {
const mgr = new PyEnvManager(nativeFinder, api);
disposables.push(mgr, api.registerEnvironmentManager(mgr));
} else {
traceInfo('Pyenv not found, turning off pyenv features.');
}
} catch (ex) {
traceInfo('Pyenv not found, turning off pyenv features.', ex);
}
}