jupyterlab-lsp icon indicating copy to clipboard operation
jupyterlab-lsp copied to clipboard

Markdown cells generate a lot of errors in browser logs and seem to block other extensions, like jupyterlab-spellchecker

Open DzmitrySudnik opened this issue 1 year ago • 2 comments

Description

Markdown cells generate a lot of errors in browser logs and seem to block other extensions, like jupyterlab-spellchecker.

Reproduce

  1. Open a new or existent .ipynb file
  2. Mark a cell as a Markdown
  3. Open browser dev tools console
  4. Start typing in the markdown cell

Expected behavior

No error, not blocking other extensions.

Context

I'm running jupyterlab in a docker container quay.io/jupyter/scipy-notebook:lab-4.1.4 with jupyterlab-lsp=5.1.0 installed on top of it (I tried going back to 5.0.3 and 5.0.1 but had the same result), also tried installing python-lsp-server and jedi-lsp-server (separately and together)

  • Operating System and version: Windows 11
  • Browser and version: Edge Version 122.0.2365.66 (Official build) (64-bit)
  • JupyterLab version: 4.1.4
  • Language server and version:
Required: installed server extensions
jupyter_lsp enabled
    - Validating jupyter_lsp...
      jupyter_lsp 2.2.4 OK
    jupyter_server_mathjax enabled
    - Validating jupyter_server_mathjax...
      jupyter_server_mathjax  OK
    jupyter_server_terminals enabled
    - Validating jupyter_server_terminals...
      jupyter_server_terminals 0.5.2 OK
    jupyterlab enabled
    - Validating jupyterlab...
      jupyterlab 4.1.4 OK
    jupyterlab_git enabled
    - Validating jupyterlab_git...
      jupyterlab_git 0.50.0 OK
    nbclassic enabled
    - Validating nbclassic...
A `_jupyter_server_extension_points` function was not found in nbclassic. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
      nbclassic 1.0.0 OK
    nbdime enabled
    - Validating nbdime...
      nbdime 4.0.1 OK
    notebook enabled
    - Validating notebook...
      notebook 7.1.1 OK
    notebook_shim enabled
    - Validating notebook_shim...
      notebook_shim  OK
Required: installed lab extensions
JupyterLab v4.1.4
/opt/conda/share/jupyter/labextensions
        jupyterlab_pygments v0.3.0 enabled OK (python, jupyterlab_pygments)
        nbdime-jupyterlab v3.0.1 enabled OK
        jupyter-matplotlib v0.11.3 enabled OK
        @jupyter-notebook/lab-extension v7.1.1 enabled OK
        @jupyter-lsp/jupyterlab-lsp v5.1.0 enabled OK (python, jupyterlab-lsp)
        @jupyter-widgets/jupyterlab-manager v5.0.10 enabled OK (python, jupyterlab_widgets)
        @jupyterlab/git v0.50.0 enabled OK (python, jupyterlab-git)
                                                                                                                                                   Disabled extensions:
@jupyterlab/completer-extension:base-service
@jupyterlab/fileeditor-extension:language-server
@jupyterlab/lsp-extension:settings
@jupyterlab/notebook-extension:language-server
Troubleshoot Output
The error happens because the map of connections doesn't have a connection for URI which ends with `python-markdown.md`
![image](https://github.com/jupyter-lsp/jupyterlab-lsp/assets/11929875/939bd7e8-4938-4b30-afbe-0f064968a1de)
![image](https://github.com/jupyter-lsp/jupyterlab-lsp/assets/11929875/b6c1cdc3-fe75-48c6-a1d8-9b6e9a2dfab3)
Command Line Output
[I 2024-03-12 17:37:54.361 ServerApp]     http://127.0.0.1:8889/lab
[I 2024-03-12 17:37:54.362 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 2024-03-12 17:37:54.765 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-03-12 17:38:10.536 LabApp] Build is up to date
[I 2024-03-12 17:38:11.951 ServerApp] Kernel started: 442201d0-7c69-425c-9d9f-cecfeb04226b
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation
Browser Output (recommended for all interface issues)
highlights.ts:343  Could not get highlights: TypeError: Cannot read properties of undefined (reading 'isReady')
    at Qt.requestHighlights (highlights.ts:217:20)
    at a.factory [as _factory] (jlab_core.4f5a04974adab2b69643.js?v=4f5a04974adab2b69643:1:1758623)
    at a._execute (jlab_core.4f5a04974adab2b69643.js?v=4f5a04974adab2b69643:1:1757091)
    at o (jlab_core.4f5a04974adab2b69643.js?v=4f5a04974adab2b69643:1:1756511)

DzmitrySudnik avatar Mar 12 '24 17:03 DzmitrySudnik

Looks like my screenshots got lost: image

DzmitrySudnik avatar Mar 12 '24 17:03 DzmitrySudnik

Thank you for the detailed report!

It looks like there should not be a non-null assertion (!) in line 214:

https://github.com/jupyter-lsp/jupyterlab-lsp/blob/71c8e0c53b6f3b609dc9ebab21fc53a45d7d8e50/packages/jupyterlab-lsp/src/features/highlights.ts#L212-L220

and there should be an extra !connection || check in the if. Would you be interested in opening a PR?

krassowski avatar Mar 12 '24 18:03 krassowski