Remove Python ext API `registerGetNotebookUriForTextDocumentUriFunction` and move code into Python/Pylance extension
Given that
- Interactive window is a core feature in VS Code,
- and all of the code used to get the Notebook Uri for the above function is not relying on any Jupyter ext,
its simpler (for maintenance) to move this code into Python/Pylance extension.
This is one less API in Python extension.
Thoughts/Concerns ? @karthiknadig @amunger @debonte
I imagine this would helped by https://github.com/microsoft/vscode/issues/154983 or even made unnecessary.
I do not believe that would help, Neither Pylance nor Python extension will not be able to use that API to determine whether a given URI is an interacrtive URI belonging to a particular notebook or not.
I started trying to move this code into Pylance and found that it calls isInteractiveInputTab which uses vscode-jupyter's InteractiveTab and TabInputInteractiveWindow types. Are the structures of these types well-defined? It looks like maybe they are vscode types that vscode-jupyter duplicated?
Are the structures of these types well-defined? It looks like maybe they are vscode types that vscode-jupyter duplicated?
Hmm, yes you are right, perhaps @amunger might have some idea why we copied the types. I believe you could either copy the types (as done here) or just add the proposed API into pylance to just get the type definitions (and ensure there's a very strict contract, to catch changes to the types).
I've removed the API from Pylance, so Pylance will no longer be relying on Python/Jupyter to provide a function to resolve the input box URI to a notebook URI. We're aiming to ship a prerelease build today (2023.12.104) that will include this change and we should be shipping a stable/release build in the next week or so.
I think once Pylance's stable build includes my change it should be safe for Python and Jupyter to remove their related code. Anyone that hits compatibility issues (ex. new Python + old Pylance) can be told to upgrade Pylance. @DonJayamanne, @karthiknadig, do you agree?
cc: @luabud
@debonte Yes, it makes sense me. for compatibility we could also set the engine number so that the right versions match for pylance/python/jupyter.
@debonte thanks, I will prepare a PR to remote this API from Jupyter extension (but will wait for Pylance to first ship befmore merging this PR)
Any idea when the next stable version goes out? is it lined up with the Python/vscode release schedule?
Any idea when the next stable version goes out? is it lined up with the Python/vscode release schedule?
Likely sometime this week. We are not in strict alignment with the vscode release schedule.
I will be removing the registerGetNotebookUriForTextDocumentUri function from Jupyter extension
The corresponding code from Python extension will need to go, however that impacts the following tests as well src/test/activation/node/lspInteractiveWindowMiddlewareAddon.unit.test.ts
Not sure where these tests should live nor whether it requires a change. Leaving that for you @debonte as you wrote those tests in the Python extension
The LspInteractiveWindowMiddlewareAddon lives in Pylance now. It was moved over there about a year ago as part of our client refactoring work. But we left the old implementation behind in vscode-python for users on older Pylance builds. I think it's safe for vscode-python to remove this now. PR is here: https://github.com/microsoft/vscode-python/pull/22985