Skip to content

Diagnostics linger in problems panel after closing untitled Jupyter Notebooks #734

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

Open
anthonykim1 opened this issue Apr 2, 2025 · 3 comments
Labels
bug Something isn't working notebook Related to (Jupyter) notebooks

Comments

@anthonykim1
Copy link

I've noticed that there are stale error/warnings that show up in the problems panel when I close an VS Code Native REPL editor tab.
If you see the video you will notice that the diagnostics from Pylance will disappear right away when I close the Native REPL window but the ones from ruff will remain.

Screen.Recording.2025-04-02.at.12.38.54.PM.mov

I realized that there are two ways extension provide/interact with diagnostics when it comes to communicating with VS Code.

/cc @rchiodo @amunger

@amunger
Copy link

amunger commented Apr 2, 2025

this also repro's for a regular untitled notebook:

  1. Create new Jupyter notebook
  2. add something that will generate a warning/error from Ruff
  3. close the notebook and discard changes

🐛 diagnostics from Ruff remain for the untitled ipynb

@dhruvmanila
Copy link
Member

Thanks for the report and providing the reproduction steps. I can reproduce it for the untitled notebook. I'll convert the issue as specific to untitled Jupyter Notebook and look into native REPL later.

@dhruvmanila dhruvmanila changed the title Stale issues remain in problems panel with VS Code Native REPL Diagnostics linger in problems panel after closing untitled Jupyter Notebooks Apr 3, 2025
@dhruvmanila dhruvmanila added bug Something isn't working notebook Related to (Jupyter) notebooks labels Apr 3, 2025
@dhruvmanila
Copy link
Member

Quickly debugging this, I found that these are the requests that VS Code sends when closing an untitled notebook:

[Trace - 10:55:35 AM] Sending notification 'notebookDocument/didClose'.
Params: {
    "notebookDocument": {
        "uri": "untitled:Untitled-1.ipynb?jupyter-notebook"
    },
    "cellTextDocuments": [
        {
            "uri": "vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W0sdW50aXRsZWQ%3D"
        }
    ]
}


[Trace - 10:55:35 AM] Sending notification 'textDocument/didClose'.
Params: {
    "textDocument": {
        "uri": "vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W0sdW50aXRsZWQ%3D"
    }
}

And, it seems that we're removing the text document before the textDocument/didClose request:

2025-04-03 10:58:38.671507000 DEBUG Unable to close document with key vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W0sdW50aXRsZWQ%3D - the snapshot was unavailable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working notebook Related to (Jupyter) notebooks
Projects
None yet
Development

No branches or pull requests

3 participants