Skip to content

Commit

Permalink
Add new extension API access
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiknadig committed Sep 28, 2024
1 parent 9f6735e commit 3ef72e8
Show file tree
Hide file tree
Showing 2 changed files with 902 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/client/envsExt/envsExtension.ts
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;
}
Loading

0 comments on commit 3ef72e8

Please sign in to comment.