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

RTC: prefix breaks go-to-definition #1107

Open
edef1c opened this issue Dec 11, 2024 · 1 comment
Open

RTC: prefix breaks go-to-definition #1107

edef1c opened this issue Dec 11, 2024 · 1 comment

Comments

@edef1c
Copy link

edef1c commented Dec 11, 2024

Description

jupyterlab/jupyter-collaboration#183 (comment)

Most extensions and some code in core JupyterLab didn't know about custom drives because the default drive doesn't have a prefix (for example, "RTC:"). This issue should be fixed on those extensions.

Reproduce

  1. Install jupyterlab, jupyter-collaboration, jupyterlab-lsp, python-lsp-server
  2. Open a Python notebook
  3. Make two cells:
x = 42
x
  1. Invoke go to definition on the second cell
  2. Get sent to .virtual_documents/RTC:Untitled.ipynb and receive a "Notebook does not appear to be JSON" error

Expected behavior

It goes to the first cell, as it would without jupyter-collaboration.

Context

  • Operating System and version: various Linux distros
  • Browser and version: Chromium 126
  • JupyterLab version: 4.3.3
  • Language server and version: python-lsp-server 1.12.0
Required: installed server extensions
(edef) [edef@jaguar ~]$ jupyter server extension list
Config dir: /home/edef/.jupyter

Config dir: /home/edef/etc/jupyter
jupyter_lsp enabled
- Validating jupyter_lsp...
jupyter_lsp 2.2.5 OK
jupyter_server_ydoc enabled
- Validating jupyter_server_ydoc...
jupyter_server_ydoc 1.1.0 OK
jupyter_server_fileid enabled
- Validating jupyter_server_fileid...
jupyter_server_fileid 0.9.3 OK
jupyter_server_terminals enabled
- Validating jupyter_server_terminals...
jupyter_server_terminals 0.5.3 OK
jupyterlab enabled
- Validating jupyterlab...
jupyterlab 4.3.3 OK
notebook_shim enabled
- Validating notebook_shim...
notebook_shim OK

Config dir: /usr/local/etc/jupyter

Required: installed lab extensions
(edef) [edef@jaguar ~]$ jupyter labextension list
JupyterLab v4.3.3
/home/edef/share/jupyter/labextensions
        jupyterlab_pygments v0.3.0 enabled OK (python, jupyterlab_pygments)
        @jupyter/docprovider-extension v3.1.0 enabled OK (python, jupyter-docprovider)
        @jupyter/collaboration-extension v3.1.0 enabled OK (python, jupyter-collaboration-ui)
        @jupyter-lsp/jupyterlab-lsp v5.1.0 enabled OK (python, jupyterlab-lsp)

Disabled extensions:
@jupyterlab/completer-extension:base-service
@jupyterlab/filebrowser-extension:defaultFileBrowser
@jupyterlab/fileeditor-extension:language-server
@jupyterlab/lsp-extension:settings
@jupyterlab/notebook-extension:cell-executor
@jupyterlab/notebook-extension:language-server

Troubleshoot Output
(edef) [edef@jaguar ~]$ jupyter troubleshoot
$PATH:
	/home/edef/bin
	/usr/local/sbin
	/usr/local/bin
	/usr/bin

sys.path:
/home/edef/bin
/usr/lib/python312.zip
/usr/lib/python3.12
/usr/lib/python3.12/lib-dynload
/home/edef/lib/python3.12/site-packages

sys.executable:
/home/edef/bin/python

sys.version:
6.12.7 (main, Oct 1 2024, 11:15:50) [GCC 14.2.1 20240910]

platform.platform():
Linux-6.6.37-x86_64-with-glibc2.40

pip list:
Package Version
------------------------- --------------
anyio 4.7.0
argon2-cffi 23.1.0
argon2-cffi-bindings 21.2.0
arrow 1.3.0
asttokens 3.0.0
async-lru 2.0.4
attrs 24.2.0
babel 2.16.0
beautifulsoup4 4.12.3
bleach 6.2.0
certifi 2024.8.30
cffi 1.17.1
charset-normalizer 3.4.0
comm 0.2.2
debugpy 1.8.10
decorator 5.1.1
defusedxml 0.7.1
docstring-to-markdown 0.15
executing 2.1.0
fastjsonschema 2.21.1
fqdn 1.5.1
h11 0.14.0
httpcore 1.0.7
httpx 0.28.1
idna 3.10
ipykernel 6.29.5
ipython 8.30.0
isoduration 20.11.0
jedi 0.19.2
Jinja2 3.1.4
json5 0.10.0
jsonpointer 3.0.0
jsonschema 4.23.0
jsonschema-specifications 2024.10.1
jupyter_client 8.6.3
jupyter-collaboration 3.1.0
jupyter-collaboration-ui 1.1.0
jupyter_core 5.7.2
jupyter-docprovider 1.1.0
jupyter-events 0.10.0
jupyter-lsp 2.2.5
jupyter_server 2.14.2
jupyter_server_fileid 0.9.3
jupyter_server_terminals 0.5.3
jupyter-server-ydoc 1.1.0
jupyter-ydoc 3.0.2
jupyterlab 4.3.3
jupyterlab-lsp 5.1.0
jupyterlab_pygments 0.3.0
jupyterlab_server 2.27.3
MarkupSafe 3.0.2
matplotlib-inline 0.1.7
mistune 3.0.2
nbclient 0.10.1
nbconvert 7.16.4
nbformat 5.10.4
nest-asyncio 1.6.0
notebook_shim 0.2.4
overrides 7.7.0
packaging 24.2
pandocfilters 1.5.1
parso 0.8.4
pexpect 4.9.0
pip 24.3.1
platformdirs 4.3.6
pluggy 1.5.0
prometheus_client 0.21.1
prompt_toolkit 3.0.48
psutil 6.1.0
ptyprocess 0.7.0
pure_eval 0.2.3
pycparser 2.22
pycrdt 0.10.8
pycrdt-websocket 0.15.3
Pygments 2.18.0
python-dateutil 2.9.0.post0
python-json-logger 2.0.7
python-lsp-jsonrpc 1.1.2
python-lsp-server 1.12.0
PyYAML 6.0.2
pyzmq 26.2.0
referencing 0.35.1
requests 2.32.3
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
rpds-py 0.22.3
Send2Trash 1.8.3
setuptools 75.6.0
six 1.17.0
sniffio 1.3.1
soupsieve 2.6
sqlite-anyio 0.2.3
stack-data 0.6.3
terminado 0.18.1
tinycss2 1.4.0
tornado 6.4.2
traitlets 5.14.3
types-python-dateutil 2.9.0.20241206
typing_extensions 4.12.2
ujson 5.10.0
uri-template 1.3.0
urllib3 2.2.3
wcwidth 0.2.13
webcolors 24.11.1
webencodings 0.5.1
websocket-client 1.8.0

Command Line Output
(edef) [edef@jaguar ~]$ jupyter-lab --ContentsManager.allow_hidden=True --no-browser
[I 2024-12-11 13:22:49.221 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2024-12-11 13:22:49.224 ServerApp] jupyter_server_fileid | extension was successfully linked.
[I 2024-12-11 13:22:49.226 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2024-12-11 13:22:49.228 ServerApp] jupyter_server_ydoc | extension was successfully linked.
[I 2024-12-11 13:22:49.231 ServerApp] jupyterlab | extension was successfully linked.
[I 2024-12-11 13:22:49.383 ServerApp] notebook_shim | extension was successfully linked.
[I 2024-12-11 13:22:49.398 ServerApp] notebook_shim | extension was successfully loaded.
[I 2024-12-11 13:22:49.400 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2024-12-11 13:22:49.400 FileIdExtension] Configured File ID manager: ArbitraryFileIdManager
[I 2024-12-11 13:22:49.400 FileIdExtension] ArbitraryFileIdManager : Configured root dir: /home/edef
[I 2024-12-11 13:22:49.400 FileIdExtension] ArbitraryFileIdManager : Configured database path: /home/edef/.local/share/jupyter/file_id_manager.db
[I 2024-12-11 13:22:49.400 FileIdExtension] ArbitraryFileIdManager : Successfully connected to database file.
[I 2024-12-11 13:22:49.400 FileIdExtension] ArbitraryFileIdManager : Creating File ID tables and indices with journal_mode = DELETE
[I 2024-12-11 13:22:49.400 FileIdExtension] Attached event listeners.
[I 2024-12-11 13:22:49.401 ServerApp] jupyter_server_fileid | extension was successfully loaded.
[I 2024-12-11 13:22:49.401 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2024-12-11 13:22:49.404 ServerApp] jupyter_server_ydoc | extension was successfully loaded.
[I 2024-12-11 13:22:49.406 LabApp] JupyterLab extension loaded from /home/edef/lib/python3.12/site-packages/jupyterlab
[I 2024-12-11 13:22:49.406 LabApp] JupyterLab application directory is /home/edef/share/jupyter/lab
[I 2024-12-11 13:22:49.406 LabApp] Extension Manager is 'pypi'.
[I 2024-12-11 13:22:49.428 ServerApp] jupyterlab | extension was successfully loaded.
[I 2024-12-11 13:22:49.429 ServerApp] Serving notebooks from local directory: /home/edef
[I 2024-12-11 13:22:49.429 ServerApp] Jupyter Server 2.14.2 is running at:
[I 2024-12-11 13:22:49.429 ServerApp] http://localhost:8888/lab?token=63e23ff45f8f348cdceef04dcd4f92860c64d7e4ceff57ec
[I 2024-12-11 13:22:49.429 ServerApp]     http://127.0.0.1:8888/lab?token=63e23ff45f8f348cdceef04dcd4f92860c64d7e4ceff57ec
[I 2024-12-11 13:22:49.429 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2024-12-11 13:22:49.431 ServerApp]
To access the server, open this file in a browser:
    file:///home/edef/.local/share/jupyter/runtime/jpserver-733-open.html
Or copy and paste one of these URLs:
    http://localhost:8888/lab?token=63e23ff45f8f348cdceef04dcd4f92860c64d7e4ceff57ec
    http://127.0.0.1:8888/lab?token=63e23ff45f8f348cdceef04dcd4f92860c64d7e4ceff57ec

[I 2024-12-11 13:22:49.446 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
[I 2024-12-11 13:22:58.895 ServerApp] 302 GET / (@::1) 0.81ms
[I 2024-12-11 13:22:58.901 LabApp] 302 GET /lab? (@::1) 0.87ms
[W 2024-12-11 13:23:08.827 LabApp] Could not determine jupyterlab build status without nodejs
[I 2024-12-11 13:23:11.567 ServerApp] Request for Y document 'Untitled.ipynb' with room ID: 01405ec7-3485-46dc-a04b-84807a006adc
[I 2024-12-11 13:23:11.725 YDocExtension] Creating FileLoader for: Untitled.ipynb
[I 2024-12-11 13:23:11.726 YDocExtension] Watching file: Untitled.ipynb
[I 2024-12-11 13:23:11.727 ServerApp] Initializing room json:notebook:01405ec7-3485-46dc-a04b-84807a006adc
[I 2024-12-11 13:23:11.775 ServerApp] Content in room json:notebook:01405ec7-3485-46dc-a04b-84807a006adc loaded from the ystore SQLiteYStore
[I 2024-12-11 13:23:11.880 ServerApp] Kernel started: 82003cee-68e1-492c-a625-c7f81d186adf
[I 2024-12-11 13:23:12.256 ServerApp] Connecting to kernel 82003cee-68e1-492c-a625-c7f81d186adf.
[I 2024-12-11 13:23:12.269 ServerApp] Connecting to kernel 82003cee-68e1-492c-a625-c7f81d186adf.
[I 2024-12-11 13:23:12.282 ServerApp] Connecting to kernel 82003cee-68e1-492c-a625-c7f81d186adf.
[I 2024-12-11 13:23:12.789 ServerApp] Saving the content from room json:notebook:01405ec7-3485-46dc-a04b-84807a006adc
[I 2024-12-11 13:23:12.790 YDocExtension] Saving file: Untitled.ipynb
[W 2024-12-11 13:23:12.819 ServerApp] 404 GET /api/contents?content=1&hash=0&1733923392814 ([email protected]) 3.53ms referer=http://127.0.0.1:8888/lab/tree/RTC%3AUntitled.ipynb
[W 2024-12-11 13:23:12.820 ServerApp] 404 GET /api/contents?content=1&hash=0&1733923392814 (127.0.0.1): No such file or directory: .jupyter_ystore.db-journal
[W 2024-12-11 13:23:21.327 ServerApp] 400 GET /api/contents/.virtual_documents/RTC%3AUntitled.ipynb?type=notebook&content=1&hash=1&1733923401316 (127.0.0.1): Unreadable Notebook: /home/edef/.virtual_documents/RTC:Untitled.ipynb NotJSONError("Notebook does not appear to be JSON: 'x = 123\n\n\nx\n'")
[W 2024-12-11 13:23:21.327 ServerApp] wrote error: 'Unreadable Notebook: /home/edef/.virtual_documents/RTC:Untitled.ipynb NotJSONError("Notebook does not appear to be JSON: 'x = 123\\n\\n\\nx\\n'")'
Traceback (most recent call last):
File "/home/edef/lib/python3.12/site-packages/tornado/web.py", line 1790, in _execute
result = await result
^^^^^^^^^^^^
File "/home/edef/lib/python3.12/site-packages/jupyter_server/auth/decorator.py", line 73, in inner
return await out
^^^^^^^^^
File "/home/edef/lib/python3.12/site-packages/jupyter_server/services/contents/handlers.py", line 154, in get
model = await ensure_async(
^^^^^^^^^^^^^^^^^^^
File "/home/edef/lib/python3.12/site-packages/jupyter_core/utils/init.py", line 198, in ensure_async
result = await obj
^^^^^^^^^
File "/home/edef/lib/python3.12/site-packages/jupyter_server/services/contents/filemanager.py", line 922, in get
model = await self._notebook_model(path, content=content, require_hash=require_hash)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/edef/lib/python3.12/site-packages/jupyter_server/services/contents/filemanager.py", line 868, in _notebook_model
nb, bytes_content = await self._read_notebook(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/edef/lib/python3.12/site-packages/jupyter_server/services/contents/fileio.py", line 471, in _read_notebook
raise HTTPError(
tornado.web.HTTPError: HTTP 400: Bad Request (Unreadable Notebook: /home/edef/.virtual_documents/RTC:Untitled.ipynb NotJSONError("Notebook does not appear to be JSON: 'x = 123\n\n\nx\n'"))
[W 2024-12-11 13:23:21.330 ServerApp] 400 GET /api/contents/.virtual_documents/RTC%3AUntitled.ipynb?type=notebook&content=1&hash=1&1733923401316 ([email protected]) 3.87ms referer=http://127.0.0.1:8888/lab/tree/.virtual_documents/RTC%3AUntitled.ipynb

(yes, this has various tokens in it, but these logs are from an ephemeral clean repro environment)

@edef1c edef1c changed the title RTC: prefix breaks go-to-definition RTC: prefix breaks go-to-definition Dec 11, 2024
@edef1c
Copy link
Author

edef1c commented Dec 11, 2024

I was hoping that pyright would fare better, since it does have requires_documents_on_disk=False, but that just gets us redirected to /.lsp_symlink/RTC:Untitled.ipynb instead.

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

No branches or pull requests

1 participant