From 40ff6e9fc1b07fef713ca552d94c86bddf2dd249 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Fri, 4 Aug 2023 10:22:31 -0700 Subject: [PATCH] Remove private Jupyter APIs from public API types (#21761) For https://github.com/microsoft/vscode-jupyter/issues/13986 --- pythonExtensionApi/package-lock.json | 4 +-- pythonExtensionApi/package.json | 2 +- src/client/api.ts | 7 +++++ src/client/api/types.ts | 46 +--------------------------- 4 files changed, 11 insertions(+), 48 deletions(-) diff --git a/pythonExtensionApi/package-lock.json b/pythonExtensionApi/package-lock.json index a03c33ab5c0d..4c5e98adbc16 100644 --- a/pythonExtensionApi/package-lock.json +++ b/pythonExtensionApi/package-lock.json @@ -1,12 +1,12 @@ { "name": "@vscode/python-extension", - "version": "1.0.2", + "version": "1.0.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@vscode/python-extension", - "version": "1.0.2", + "version": "1.0.3", "license": "MIT", "devDependencies": { "@types/vscode": "^1.78.0", diff --git a/pythonExtensionApi/package.json b/pythonExtensionApi/package.json index dd0e921f8abe..271542f161ec 100644 --- a/pythonExtensionApi/package.json +++ b/pythonExtensionApi/package.json @@ -1,7 +1,7 @@ { "name": "@vscode/python-extension", "description": "An API facade for the Python extension in VS Code", - "version": "1.0.2", + "version": "1.0.3", "author": { "name": "Microsoft Corporation" }, diff --git a/src/client/api.ts b/src/client/api.ts index 2371a4d88de1..23b2553c93d2 100644 --- a/src/client/api.ts +++ b/src/client/api.ts @@ -35,6 +35,13 @@ export function buildApi( const outputChannel = serviceContainer.get(ILanguageServerOutputChannel); const api: PythonExtension & { + /** + * Internal API just for Jupyter, hence don't include in the official types. + */ + jupyter: { + registerHooks(): void; + }; + } & { /** * @deprecated Temporarily exposed for Pylance until we expose this API generally. Will be removed in an * iteration or two. diff --git a/src/client/api/types.ts b/src/client/api/types.ts index 63954a16d868..4de554bf5a24 100644 --- a/src/client/api/types.ts +++ b/src/client/api/types.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import { CancellationToken, Event, Uri, WorkspaceFolder, QuickPickItem, extensions } from 'vscode'; +import { CancellationToken, Event, Uri, WorkspaceFolder, extensions } from 'vscode'; /* * Do not introduce any breaking changes to this API. @@ -12,9 +12,6 @@ export interface PythonExtension { * Promise indicating whether all parts of the extension have completed loading or not. */ ready: Promise; - jupyter: { - registerHooks(): void; - }; debug: { /** * Generate an array of strings for commands to pass to the Python executable to launch the debugger for remote debugging. @@ -109,47 +106,6 @@ export interface PythonExtension { }; } -interface IJupyterServerUri { - baseUrl: string; - token: string; - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - authorizationHeader: any; // JSON object for authorization header. - expiration?: Date; // Date/time when header expires and should be refreshed. - displayName: string; -} - -type JupyterServerUriHandle = string; - -export interface IJupyterUriProvider { - readonly id: string; // Should be a unique string (like a guid) - getQuickPickEntryItems(): QuickPickItem[]; - handleQuickPick(item: QuickPickItem, backEnabled: boolean): Promise; - getServerUri(handle: JupyterServerUriHandle): Promise; -} - -interface IDataFrameInfo { - columns?: { key: string; type: ColumnType }[]; - indexColumn?: string; - rowCount?: number; -} - -export interface IDataViewerDataProvider { - dispose(): void; - getDataFrameInfo(): Promise; - getAllRows(): Promise; - getRows(start: number, end: number): Promise; -} - -enum ColumnType { - String = 'string', - Number = 'number', - Bool = 'bool', -} - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -type IRowsResponse = any[]; - export type RefreshOptions = { /** * When `true`, force trigger a refresh regardless of whether a refresh was already triggered. Note this can be expensive so