forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f6735e
commit 3ef72e8
Showing
2 changed files
with
902 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { getExtension } from '../common/vscodeApis/extensionsApi'; | ||
import { PythonEnvironmentApi } from './types'; | ||
|
||
export const ENVS_EXTENSION_ID = 'ms-python.vscode-python-envs'; | ||
|
||
let api: PythonEnvironmentApi | undefined; | ||
export async function getEnvsApi(): Promise<PythonEnvironmentApi | undefined> { | ||
if (api) { | ||
return api; | ||
} | ||
|
||
const extension = getExtension<PythonEnvironmentApi>(ENVS_EXTENSION_ID); | ||
if (extension) { | ||
if (!extension.isActive) { | ||
await extension.activate(); | ||
api = extension.exports; | ||
return api; | ||
} | ||
} | ||
return undefined; | ||
} |
Oops, something went wrong.