-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standalone transclusions are not reusing connections anymore #959
Comments
|
There is a partial workaround I included earlier, but this only prevents infinite loops, not replacement of virtual document connections: jupyterlab-lsp/packages/jupyterlab-lsp/src/adapters/notebook.ts Lines 50 to 77 in 74e0d07
|
IIRC we decided to drop the transclusion via magics but keep supporting the LSP for different cell types, that's why the extractors were kept. |
I agree this issue needs to be solved, because if I want to have different cells to have different language support inside the python notebook, I need to have standalone virtual documents for each cell respectively (specific use case is that I can have sql cells and python cells at the same time inside the notebook). Now this is an issue in JL4, which was not happening in JL3. As shown in the screenshot every keystroke opens a new connection if I specify standalone as true and causes infinitely duplicated lsp connection to the same cells. |
Standalone documents represent fragments of code which are independent of any preceding and following code. An example in IPython is (each block represents a cell):
There used to be a logic for reusing connections for standalone documents, which greatly improved performance (without it LSP becomes unavailable in the standalone document for 1-2 seconds while a new connection is established; it also risks saturating the number of websockets etc)
jupyterlab-lsp/packages/jupyterlab-lsp/src/virtual/document.ts
Lines 477 to 503 in ff8b6c4
This was removed when the code was moved upstream to
@jupyterlab/lsp
- it is no longer inchooseForeignDocument
. The removal was not complete asunusedStandaloneDocuments
was retained, even though it is no longer populated.It might be possible to monkeypatch the
VirtualDocument
downstream to restore this logic, or to restore this upstream but it might benefit from a larger refactor as arguably it was not very well written (it should be a responsibility of connection manager, not virtual document).Before I start working on it I would like ask for some community support to indicate whether there is a need for this - if you are using this extension in JupyterLab 4.0 and are affected by the performance in standalone documents, please leave a comment/upvote.
The text was updated successfully, but these errors were encountered: