diff --git a/src/platform/api/types.ts b/src/platform/api/types.ts index 8e0fe50e3dd..983b8063c21 100644 --- a/src/platform/api/types.ts +++ b/src/platform/api/types.ts @@ -91,12 +91,4 @@ export interface PythonApi { * @param func : The function that Python should call when requesting the Python path. */ registerJupyterPythonPathFunction(func: (uri: Uri) => Promise): void; - - /** - * Call to provide a function that the Python extension can call to request the notebook - * document URI related to a particular text document URI, or undefined if there is no - * associated notebook. - * @param func : The function that Python should call when requesting the notebook URI. - */ - registerGetNotebookUriForTextDocumentUriFunction(func: (textDocumentUri: Uri) => Uri | undefined): void; } diff --git a/src/standalone/intellisense/notebookPythonPathService.node.ts b/src/standalone/intellisense/notebookPythonPathService.node.ts index d7b22d8afde..ef0daccccda 100644 --- a/src/standalone/intellisense/notebookPythonPathService.node.ts +++ b/src/standalone/intellisense/notebookPythonPathService.node.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { inject, injectable } from 'inversify'; -import { Disposable, extensions, Uri, window } from 'vscode'; +import { Disposable, extensions, Uri } from 'vscode'; import { INotebookEditorProvider } from '../../notebooks/types'; import { IExtensionSyncActivationService } from '../../platform/activation/types'; import { IPythonApiProvider, IPythonExtensionChecker } from '../../platform/api/types'; @@ -10,12 +10,11 @@ import { PylanceExtension } from '../../platform/common/constants'; import { getDisplayPath, getFilePath } from '../../platform/common/platform/fs-paths'; import { traceInfo } from '../../platform/logging'; import { IControllerRegistration } from '../../notebooks/controllers/types'; -import { isInteractiveInputTab } from '../../interactive-window/helpers'; import { IKernelProvider, isRemoteConnection } from '../../kernels/types'; import { noop } from '../../platform/common/utils/misc'; import { raceTimeout } from '../../platform/common/utils/async'; import * as fs from 'fs-extra'; -import { getNotebookUriFromInputBoxUri, isUsingPylance } from './notebookPythonPathService'; +import { isUsingPylance } from './notebookPythonPathService'; /** * Manages use of the Python extension's registerJupyterPythonPathFunction API which @@ -51,11 +50,6 @@ export class NotebookPythonPathService implements IExtensionSyncActivationServic if (api.registerJupyterPythonPathFunction !== undefined) { api.registerJupyterPythonPathFunction((uri) => this._jupyterPythonPathFunction(uri)); } - if (api.registerGetNotebookUriForTextDocumentUriFunction !== undefined) { - api.registerGetNotebookUriForTextDocumentUriFunction((uri) => - this._getNotebookUriForTextDocumentUri(uri) - ); - } }) .catch(noop); } @@ -151,25 +145,4 @@ del _VSCODE_os, _VSCODE_sys, _VSCODE_builtins } return getFilePath(interpreter.uri); } - - private _getNotebookUriForTextDocumentUri(textDocumentUri: Uri): Uri | undefined { - const notebookUri = getNotebookUriFromInputBoxUri(textDocumentUri); - if (!notebookUri) { - return undefined; - } - - let result: string | undefined = undefined; - window.tabGroups.all.find((group) => { - group.tabs.find((tab) => { - if (isInteractiveInputTab(tab)) { - const tabUri = tab.input.uri.toString(); - // the interactive resource URI was altered to start with `/`, this will account for both URI formats - if (tab.input.uri.toString().endsWith(notebookUri.path)) { - result = tabUri; - } - } - }); - }); - return result; - } }