Skip to content
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

Remove unusedDocuments, fix culling of foreign documents #15105

Merged
merged 4 commits into from
Sep 14, 2023

Conversation

krassowski
Copy link
Member

@krassowski krassowski commented Sep 10, 2023

References

Follow up to #12534
Developed in response to a failing test caught on jupyter-lsp/jupyterlab-lsp#978

Code changes

  • The unused protected property unusedDocuments is removed (it was never written to since Integrate jupyterlab-lsp into jupyterlab #12534, it was functioning properly with different logic in lsp extension)
  • The logic to cull the unused foreign documents is re-implemented in closeExpiredDocuments() without need to keep state on the VirtualDocument instance

User-facing changes

When user creates a markdown or raw cell and then deletes it (without other cells of this type present), the connection to LSP server is not held indefinitely but culled after six further document changes.

Backwards-incompatible changes

Removal of the protected unusedDocuments method is notable but we are not advertising LSP as stable yet, and it would be useless in the current state anyways so it should be fine.

@jupyterlab-probot
Copy link

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @krassowski

document.remainingLifetime -= 1;
if (document.remainingLifetime <= 0) {
document.dispose();
const ids = documentIDs.get(document)!;
for (const id of ids) {
this.foreignDocuments.delete(id);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a test for this case?

These were needed in LSP because it subclasses `VirtualDocument`,
but are not needed upstream in JupyterLab itself.
@krassowski krassowski modified the milestones: 4.0.x, 4.1.0 Sep 12, 2023
@krassowski krassowski merged commit 539a55d into jupyterlab:main Sep 14, 2023
77 of 78 checks passed
@krassowski
Copy link
Member Author

@meeseeksdev please backport to 4.0.x

meeseeksmachine pushed a commit to meeseeksmachine/jupyterlab that referenced this pull request Sep 14, 2023
fcollonval pushed a commit that referenced this pull request Sep 18, 2023
…documents (#15121)

Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants