astral-sh/ruff-vscode

ruff server: Document controller not available at `untitled:Untitled-1.ipynb?jupyter-notebook`

T-256 opened this issue · 2 comments

Repro on VSCode v1.94.0:

  • Create new jupyter notebook untitled file via:
    image
2024-10-05 14:20:04.141 [info] Using interpreter: c:\Python37x86\python.exe
2024-10-05 14:20:04.148 [info] Using bundled executable: c:\Users\User\.vscode\extensions\charliermarsh.ruff-2024.50.0-win32-x64\bundled\libs\bin\ruff.exe
2024-10-05 14:20:04.206 [info] Resolved 'ruff.nativeServer: auto' to use the native server
2024-10-05 14:20:04.208 [info] Found Ruff 0.6.6 at c:\Users\User\.vscode\extensions\charliermarsh.ruff-2024.50.0-win32-x64\bundled\libs\bin\ruff.exe
2024-10-05 14:20:04.208 [info] Server run command: c:\Users\User\.vscode\extensions\charliermarsh.ruff-2024.50.0-win32-x64\bundled\libs\bin\ruff.exe server
2024-10-05 14:20:04.209 [info] Server: Start requested.
2024-10-05 14:20:04.217 [info] [Trace - 2:20:04 PM] Sending request 'initialize - (0)'.
2024-10-05 14:20:04.252 [info] [Trace - 2:20:04 PM] Received response 'initialize - (0)' in 36ms.
2024-10-05 14:20:04.253 [info] [Trace - 2:20:04 PM] Sending notification 'initialized'.
2024-10-05 14:20:04.256 [info] [Trace - 2:20:04 PM] Sending notification 'textDocument/didOpen'.
2024-10-05 14:20:04.256 [info] [Trace - 2:20:04 PM] Sending request 'textDocument/diagnostic - (1)'.
2024-10-05 14:20:04.257 [info] [Trace - 2:20:04 PM] Sending notification 'notebookDocument/didOpen'.
2024-10-05 14:20:04.283 [info] [Trace - 2:20:04 PM] Received request 'client/registerCapability - (1)'.
2024-10-05 14:20:04.283 [info] [Trace - 2:20:04 PM] Sending response 'client/registerCapability - (1)'. Processing request took 1ms
2024-10-05 14:20:04.284 [info] [Trace - 2:20:04 PM] Received notification 'textDocument/publishDiagnostics'.
2024-10-05 14:20:04.284 [info] [Trace - 2:20:04 PM] Received response 'textDocument/diagnostic - (1)' in 28ms.
2024-10-05 14:20:04.285 [info] [Trace - 2:20:04 PM]    0.029987400s  INFO ruff:main ruff_server::server: Configuration file watcher successfully registered

2024-10-05 14:23:35.158 [info] [Trace - 2:23:35 PM] Sending notification 'textDocument/didChange'.
2024-10-05 14:23:35.159 [info] [Trace - 2:23:35 PM] Sending notification 'notebookDocument/didOpen'.
2024-10-05 14:23:35.163 [info] [Trace - 2:23:35 PM]  210.906773400s ERROR ruff:main ruff_server::server::api: An error occurred while running textDocument/didChange: Document controller not available at `untitled:Untitled-1.ipynb?jupyter-notebook`

2024-10-05 14:23:35.163 [info] [Trace - 2:23:35 PM] Received notification 'window/showMessage'.
2024-10-05 14:23:35.163 [info] [Trace - 2:23:35 PM] Received notification 'textDocument/publishDiagnostics'.
2024-10-05 14:23:35.180 [info] [Trace - 2:23:35 PM] Sending notification 'notebookDocument/didChange'.
2024-10-05 14:23:35.181 [info] [Trace - 2:23:35 PM] Received notification 'textDocument/publishDiagnostics'.
2024-10-05 14:23:35.658 [info] [Trace - 2:23:35 PM] Sending notification 'notebookDocument/didChange'.
2024-10-05 14:23:35.785 [info] [Trace - 2:23:35 PM] Received notification 'textDocument/publishDiagnostics'.

it works on legacy server with this warning:

2024-10-05 14:28:39.948 [info] 2024-10-05 14:28:39,945 WARNING Ignoring notification for unknown method "textDocument/didChange"

Is it possible it's VSCode bug since sends textDocument/didChange for first cell before notebookDocument/didOpen?
here is verbose logs:

2024-10-05 14:32:13.007 [info] [Trace - 2:32:13 PM] Sending notification 'textDocument/didChange'.
2024-10-05 14:32:13.007 [info] Params: {
    "textDocument": {
        "uri": "vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W0sdW50aXRsZWQ%3D",
        "version": 2
    },
    "contentChanges": [
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 14
                }
            },
            "rangeLength": 14,
            "text": ""
        }
    ]
}


2024-10-05 14:32:13.009 [info] [Trace - 2:32:13 PM] Sending notification 'notebookDocument/didOpen'.
2024-10-05 14:32:13.009 [info] Params: {
    "notebookDocument": {
        "uri": "untitled:Untitled-1.ipynb?jupyter-notebook",
        "notebookType": "jupyter-notebook",
        "version": 1,
        "cells": [
            {
                "kind": 2,
                "document": "vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W0sdW50aXRsZWQ%3D"
            }
        ],
        "metadata": {
            "cells": [],
            "metadata": {},
            "indentAmount": " ",
            "nbformat": 4,
            "nbformat_minor": 2
        }
    },
    "cellTextDocuments": [
        {
            "uri": "vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W0sdW50aXRsZWQ%3D",
            "languageId": "python",
            "version": 2,
            "text": ""
        }
    ]
}


2024-10-05 14:32:13.012 [info] [Trace - 2:32:13 PM]   15.355384300s ERROR ruff:main ruff_server::server::api: An error occurred while running textDocument/didChange: Document controller not available at `untitled:Untitled-1.ipynb?jupyter-notebook`

Ok, it seems fixed after updating Jupyter Extension and restart VSCode.