Skip to content

Commit 5d23f5b

Browse files
edvilmeCopilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 9a16a1b commit 5d23f5b

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

scripts/compare_package_versions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def main() -> int:
6363
if extension_version != api_version:
6464
print(
6565
f"::error::Version mismatch: package.json is {extension_version} but "
66-
f"api/package.json is {api_version}. Update api/package.json to match."
66+
f"api/package.json is {api_version}. Update package.json and/or api/package.json so both versions match."
6767
)
6868
return 1
6969

src/api.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,15 +1421,13 @@ export namespace PythonEnvironments {
14211421
/**
14221422
* Returns the API exposed by the Python Environments extension in VS Code.
14231423
*/
1424-
export async function api(): Promise<PythonEnvironmentApi> {
1425-
const extension = extensions.getExtension(EXTENSION_ID);
1426-
if (extension === undefined) {
1427-
throw new Error(`Python Environments extension is not installed or is disabled`);
1428-
}
1429-
if (!extension.isActive) {
1430-
await extension.activate();
1431-
}
1432-
const pythonEnvsApi: PythonEnvironmentApi = extension.exports;
1433-
return pythonEnvsApi;
1424+
export async function api(): Promise<PythonEnvironmentApi> {
1425+
const extension = extensions.getExtension<PythonEnvironmentApi>(EXTENSION_ID);
1426+
if (extension === undefined) {
1427+
throw new Error(`Python Environments extension (${EXTENSION_ID}) is not installed or is disabled`);
14341428
}
1429+
if (!extension.isActive) {
1430+
await extension.activate();
1431+
}
1432+
return extension.exports;
14351433
}

0 commit comments

Comments
 (0)