From 15dfed0f05f0c7959d0d879d035f4effcc6d3112 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Sun, 29 Dec 2024 23:14:43 +1100 Subject: [PATCH] Update API to return the exe --- src/api.proposed.notebookEnvironment.ts | 19 ++++++------------- src/standalone/api/index.ts | 5 +++-- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/api.proposed.notebookEnvironment.ts b/src/api.proposed.notebookEnvironment.ts index 68fa08715d4..f253dd791c0 100644 --- a/src/api.proposed.notebookEnvironment.ts +++ b/src/api.proposed.notebookEnvironment.ts @@ -20,18 +20,11 @@ declare module './api' { * @param uri */ getPythonEnvironment(uri: Uri): - | undefined - | { - /** - * The ID of the environment. - */ - readonly id: string; - /** - * Path to environment folder or path to python executable that uniquely identifies an environment. Environments - * lacking a python executable are identified by environment folder paths, whereas other envs can be identified - * using python executable path. - */ - readonly path: string; - }; + | undefined /** + * Path to environment folder or path to python executable that uniquely identifies an environment. Environments + * lacking a python executable are identified by environment folder paths, whereas other envs can be identified + * using python executable path. + */ + | string; } } diff --git a/src/standalone/api/index.ts b/src/standalone/api/index.ts index 0820d49436f..916ca0952b2 100644 --- a/src/standalone/api/index.ts +++ b/src/standalone/api/index.ts @@ -64,11 +64,12 @@ export function buildApi( onDidChangePythonEnvironment: envApi.onDidChangeEnvironment, // Only for use By Python, hence this is proposed API and can change anytime. // Do not add this to Kernels or other namespaces, as this is only for Python. - getPythonEnvironment(uri: Uri): EnvironmentPath | undefined { + getPythonEnvironment(uri: Uri): string | undefined { // This is a proposed API that is only used by the Python extension. // Hence the reason to keep this separate. // This way we can keep the API stable for other extensions (which would be the majority case). - return envApi.getPythonEnvironment(uri); + // eslint-disable-next-line local-rules/dont-use-fspath + return envApi.getPythonEnvironment(uri)?.executable?.uri?.fsPath; } };