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

Avoid close cells on notebookDocument/didClose #11867

Conversation

T-256
Copy link
Contributor

@T-256 T-256 commented Jun 14, 2024

Summary

Fixes #11651
Fixes #11851

As a follow-up of #11864

Test Plan

Close (Ctrl+F4) documents with type of notebook/interactive-window/untitled-notebook and check no popup error message shows.

})?;
}
}
// notebook cells are closed via textDocument/didClose - we don't close them here.
Copy link
Member

Choose a reason for hiding this comment

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

Does that mean that VS code sends an explicit didClose request before (or after) for the cells?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it always will send textDocument/didClose either before or after.

  • I noticed on regular file:// urls it sends textDocument/didClose per cell before notebookDocument/didClose:
2024-06-14 16:46:48.544 [info] [Trace - 4:46:48 PM] Sending notification 'textDocument/didClose'.
2024-06-14 16:46:48.544 [info] Params: {
    "textDocument": {
        "uri": "vscode-notebook-cell:/e%3A/test/test.ipynb#W0sZmlsZQ%3D%3D"
    }
}


2024-06-14 16:46:48.544 [info] [Trace - 4:46:48 PM] Sending notification 'textDocument/didClose'.
2024-06-14 16:46:48.544 [info] Params: {
    "textDocument": {
        "uri": "vscode-notebook-cell:/e%3A/test/test.ipynb#W1sZmlsZQ%3D%3D"
    }
}


2024-06-14 16:46:48.544 [info] [Trace - 4:46:48 PM] Sending notification 'notebookDocument/didClose'.
2024-06-14 16:46:48.544 [info] Params: {
    "notebookDocument": {
        "uri": "file:///e%3A/test/test.ipynb"
    },
    "cellTextDocuments": [
        {
            "uri": "vscode-notebook-cell:/e%3A/test/test.ipynb#W0sZmlsZQ%3D%3D"
        },
        {
            "uri": "vscode-notebook-cell:/e%3A/test/test.ipynb#W1sZmlsZQ%3D%3D"
        }
    ]
}


2024-06-14 16:46:48.545 [info] [Trace - 4:46:48 PM] Received notification 'textDocument/publishDiagnostics'.
2024-06-14 16:46:48.545 [info] Params: {
    "diagnostics": [],
    "uri": "vscode-notebook-cell:/e%3A/test/test.ipynb#W0sZmlsZQ%3D%3D",
    "version": 2
}


2024-06-14 16:46:48.545 [info] [Trace - 4:46:48 PM] Received notification 'textDocument/publishDiagnostics'.
2024-06-14 16:46:48.545 [info] Params: {
    "diagnostics": [],
    "uri": "vscode-notebook-cell:/e%3A/test/test.ipynb#W1sZmlsZQ%3D%3D",
    "version": 2
}
  • For "untitled:Untitled-1.ipynb" and "untitled:/Interactive-2.interactive" urls it will send textDocument/didClose per cell after notebookDocument/didClose:
2024-06-14 16:58:23.344 [info] [Trace - 4:58:23 PM] Sending notification 'notebookDocument/didClose'.
2024-06-14 16:58:23.344 [info] Params: {
    "notebookDocument": {
        "uri": "untitled:Untitled-1.ipynb?jupyter-notebook"
    },
    "cellTextDocuments": [
        {
            "uri": "vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W0sdW50aXRsZWQ%3D"
        }
    ]
}


2024-06-14 16:58:23.364 [info] [Trace - 4:58:23 PM] Sending notification 'textDocument/didClose'.
2024-06-14 16:58:23.364 [info] Params: {
    "textDocument": {
        "uri": "vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W0sdW50aXRsZWQ%3D"
    }
}


2024-06-14 16:58:23.365 [info] 1173.763966200s ERROR ruff:main ruff_server::server::api: An error occurred while running textDocument/didClose: Unable to take snapshot for document with URL vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W0sdW50aXRsZWQ%3D

2024-06-14 16:58:23.365 [info] [Trace - 4:58:23 PM] Received notification 'window/showMessage'.
2024-06-14 16:58:23.365 [info] Params: {
    "message": "Ruff encountered a problem. Check the logs for more details.",
    "type": 1
}

@T-256 T-256 closed this Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants