jupyterlab-lsp
jupyterlab-lsp copied to clipboard
TexLab candidates not refreshed
Description
I'm getting the following issue with candidate suggestions from TexLab. I've tried installing with a new environment in conda, using version 3.0.0 of jupyterlab-lsp and had a friend install it on his machine.
Here when I type \, TexLab sends its first 50 (the default for TexLab) candidates. But as I continue to type, it never sends any more. It should be sending a new list of candidates with each keystroke. This also occurs when using tab to auto-complete.

Reproduce
- Install jupyterlab-lsp and TexLab with
conda install -c conda-forge 'jupyterlab>=3.0.0,<4.0.0a0' jupyterlab-lsp texlab chktex - Create a new .tex document
- Type
\for the first 50 candidates to be suggested - Continue typing
doc, and notice no new candidates are suggested
Expected behavior
A new list of 50 candidates should be continually suggested as the user types (unless TexLab returns less than 50 of course)
Context
- Operating System and version: Ubuntu 20.04.3 LTS
- Browser and version: Firefox 98.0 (64-bit)
- JupyterLab version: 3.3.1
- Language server and version: texlab 2.2.2
Required: installed server extensions
Config dir: /home/user/.jupyter
Config dir: /home/user/.conda/envs/jupyterlab-extension-dev/etc/jupyter
jupyter_lsp enabled
- Validating jupyter_lsp...
jupyter_lsp 1.5.1 OK
jupyterlab enabled
- Validating jupyterlab...
jupyterlab 3.3.1 OK
nbclassic enabled
- Validating nbclassic...
nbclassic OK
Config dir: /usr/local/etc/jupyter
jupyterlab enabled
- Validating jupyterlab...
jupyterlab 3.3.1 OK
nbclassic enabled
- Validating nbclassic...
nbclassic OK
Required: installed lab extensions
JupyterLab v3.3.1
/home/user/.conda/envs/jupyterlab-extension-dev/share/jupyter/labextensions
@krassowski/jupyterlab-lsp v3.10.0 enabled OK (python, jupyterlab-lsp)
@jupyterlab/latex v3.1.0 enabled OK
Troubleshoot Output
$PATH: /home/user/.conda/envs/jupyterlab-extension-dev/bin /home/user/.conda/envs/jupyterlab-extension-dev/bin /home/user/.conda/envs/jupyterlab-extension-dev/bin /home/user/.conda/envs/jupyterlab-extension-dev/bin /home/user/.conda/envs/jupyterlab-extension-dev/bin /home/user/.conda/envs/jupyterlab-extension-dev/bin /root/miniconda3/condabin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin /root/miniconda3/bin sys.path: /home/user/.conda/envs/jupyterlab-extension-dev/bin /home/user/.conda/envs/jupyterlab-extension-dev/lib/python39.zip /home/user/.conda/envs/jupyterlab-extension-dev/lib/python3.9 /home/user/.conda/envs/jupyterlab-extension-dev/lib/python3.9/lib-dynload /home/user/.conda/envs/jupyterlab-extension-dev/lib/python3.9/site-packages /home/user/jupyterlab-latex sys.executable: /home/user/.conda/envs/jupyterlab-extension-dev/bin/python sys.version: 3.9.7 (default, Sep 16 2021, 13:09:58) [GCC 7.5.0] platform.platform(): Linux-5.13.0-27-generic-x86_64-with-glibc2.31 which -a jupyter: /home/user/.conda/envs/jupyterlab-extension-dev/bin/jupyter /home/user/.conda/envs/jupyterlab-extension-dev/bin/jupyter /home/user/.conda/envs/jupyterlab-extension-dev/bin/jupyter /home/user/.conda/envs/jupyterlab-extension-dev/bin/jupyter /home/user/.conda/envs/jupyterlab-extension-dev/bin/jupyter /home/user/.conda/envs/jupyterlab-extension-dev/bin/jupyter /usr/local/bin/jupyter pip list: Package Version Editable project location -------------------- --------- --------------------------- anyio 3.5.0 argon2-cffi 21.3.0 argon2-cffi-bindings 21.2.0 asttokens 2.0.5 attrs 21.4.0 Babel 2.9.1 backcall 0.2.0 bleach 4.1.0 brotlipy 0.7.0 certifi 2021.10.8 cffi 1.15.0 charset-normalizer 2.0.4 cryptography 36.0.0 debugpy 1.5.1 decorator 5.1.1 defusedxml 0.7.1 deprecation 2.1.0 docutils 0.18.1 entrypoints 0.3 executing 0.8.3 html5lib 1.1 idna 3.3 importlib-metadata 4.8.2 iniconfig 1.1.1 ipykernel 6.9.1 ipython 8.1.1 ipython-genutils 0.2.0 jedi 0.18.1 Jinja2 3.0.2 json5 0.9.6 jsonschema 3.2.0 jupyter-client 7.1.2 jupyter-core 4.9.2 jupyter-lsp 1.5.1 jupyter-packaging 0.11.1 jupyter-server 1.13.5 jupyterlab 3.3.1 jupyterlab-latex 3.1.0 /home/user/jupyterlab-latex jupyterlab-lsp 3.10.0 jupyterlab-pygments 0.1.2 jupyterlab-server 2.10.3 MarkupSafe 2.0.1 matplotlib-inline 0.1.2 mistune 0.8.4 nbclassic 0.3.5 nbclient 0.5.11 nbconvert 6.3.0 nbformat 5.1.3 nest-asyncio 1.5.1 notebook 6.4.8 packaging 21.3 pandocfilters 1.5.0 parso 0.8.3 pexpect 4.8.0 pickleshare 0.7.5 pip 21.3.1 pluggy 1.0.0 prometheus-client 0.13.1 prompt-toolkit 3.0.20 ptyprocess 0.7.0 pure-eval 0.2.2 py 1.11.0 pycparser 2.21 Pygments 2.11.2 pyOpenSSL 22.0.0 pyparsing 3.0.4 pyrsistent 0.18.0 PySocks 1.7.1 pytest 6.2.5 pytest-check-links 0.5.2 python-dateutil 2.8.2 pytz 2021.3 pyzmq 22.3.0 requests 2.27.1 Send2Trash 1.8.0 setuptools 58.0.4 six 1.16.0 sniffio 1.2.0 stack-data 0.2.0 terminado 0.13.1 testpath 0.5.0 toml 0.10.2 tomlkit 0.9.2 tornado 6.1 traitlets 5.1.1 typing-extensions 3.10.0.2 urllib3 1.26.8 wcwidth 0.2.5 webencodings 0.5.1 websocket-client 0.58.0 wheel 0.37.1 zipp 3.7.0 conda list: # packages in environment at /home/user/.conda/envs/jupyterlab-extension-dev: # # Name Version Build Channel _libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 1_gnu conda-forge anyio 3.5.0 py39h06a4308_0 argon2-cffi 21.3.0 pyhd3eb1b0_0 argon2-cffi-bindings 21.2.0 py39h7f8727e_0 asttokens 2.0.5 pyhd3eb1b0_0 attrs 21.4.0 pyhd3eb1b0_0 babel 2.9.1 pyhd3eb1b0_0 backcall 0.2.0 pyhd3eb1b0_0 bleach 4.1.0 pyhd3eb1b0_0 brotlipy 0.7.0 py39h27cfd23_1003 ca-certificates 2021.10.8 ha878542_0 conda-forge certifi 2021.10.8 py39hf3d152e_1 conda-forge cffi 1.15.0 py39hd667e15_1 charset-normalizer 2.0.4 pyhd3eb1b0_0 chktex 1.7.6 he28a2e2_0 conda-forge cryptography 36.0.0 py39h9ce1e76_0 debugpy 1.5.1 py39h295c915_0 decorator 5.1.1 pyhd3eb1b0_0 defusedxml 0.7.1 pyhd3eb1b0_0 deprecation 2.1.0 pyhd3eb1b0_0 docutils 0.18.1 py39h06a4308_2 entrypoints 0.3 py39h06a4308_0 executing 0.8.3 pyhd3eb1b0_0 html5lib 1.1 pyhd3eb1b0_0 icu 69.1 h9c3ff4c_0 conda-forge idna 3.3 pyhd3eb1b0_0 importlib-metadata 4.8.2 py39h06a4308_0 importlib_metadata 4.8.2 hd3eb1b0_0 iniconfig 1.1.1 pyhd3eb1b0_0 ipykernel 6.9.1 py39h06a4308_0 ipython 8.1.1 py39h06a4308_0 ipython_genutils 0.2.0 pyhd3eb1b0_1 jedi 0.18.1 py39h06a4308_1 jinja2 3.0.2 pyhd3eb1b0_0 json5 0.9.6 pyhd3eb1b0_0 jsonschema 3.2.0 pyhd3eb1b0_2 jupyter-lsp 1.5.1 pyhd8ed1ab_0 conda-forge jupyter-packaging 0.11.1 pyhd8ed1ab_0 conda-forge jupyter_client 7.1.2 pyhd3eb1b0_0 jupyter_core 4.9.2 py39h06a4308_0 jupyter_server 1.13.5 pyhd3eb1b0_0 jupyterlab 3.3.1 pyhd8ed1ab_0 conda-forge jupyterlab-latex 3.1.0 dev_0jupyterlab-lsp 3.10.0 pyhd8ed1ab_0 conda-forge jupyterlab_pygments 0.1.2 py_0 jupyterlab_server 2.10.3 pyhd3eb1b0_1 ld_impl_linux-64 2.35.1 h7274673_9 libffi 3.3 he6710b0_2 libgcc-ng 11.2.0 h1d223b6_12 conda-forge libgomp 11.2.0 h1d223b6_12 conda-forge libsodium 1.0.18 h7b6447c_0 libstdcxx-ng 11.2.0 he4da1e4_12 conda-forge libuv 1.43.0 h7f98852_0 conda-forge libzlib 1.2.11 h36c2ea0_1013 conda-forge markupsafe 2.0.1 py39h27cfd23_0 matplotlib-inline 0.1.2 pyhd3eb1b0_2 mistune 0.8.4 py39h27cfd23_1000 nbclassic 0.3.5 pyhd3eb1b0_0 nbclient 0.5.11 pyhd3eb1b0_0 nbconvert 6.3.0 py39h06a4308_0 nbformat 5.1.3 pyhd3eb1b0_0 ncurses 6.3 h7f8727e_2 nest-asyncio 1.5.1 pyhd3eb1b0_0 nodejs 17.4.0 h8ca31f7_0 conda-forge notebook 6.4.8 py39h06a4308_0 openssl 1.1.1l h7f98852_0 conda-forge packaging 21.3 pyhd3eb1b0_0 pandocfilters 1.5.0 pyhd3eb1b0_0 parso 0.8.3 pyhd3eb1b0_0 pexpect 4.8.0 pyhd3eb1b0_3 pickleshare 0.7.5 pyhd3eb1b0_1003 pip 21.3.1 pyhd8ed1ab_0 conda-forge pluggy 1.0.0 py39h06a4308_0 prometheus_client 0.13.1 pyhd3eb1b0_0 prompt-toolkit 3.0.20 pyhd3eb1b0_0 ptyprocess 0.7.0 pyhd3eb1b0_2 pure_eval 0.2.2 pyhd3eb1b0_0 py 1.11.0 pyhd3eb1b0_0 pycparser 2.21 pyhd3eb1b0_0 pygments 2.11.2 pyhd3eb1b0_0 pyopenssl 22.0.0 pyhd3eb1b0_0 pyparsing 3.0.4 pyhd3eb1b0_0 pyrsistent 0.18.0 py39heee7806_0 pysocks 1.7.1 py39h06a4308_0 pytest 6.2.5 py39h06a4308_2 pytest-check-links 0.5.2 pyhd8ed1ab_0 conda-forge python 3.9.7 h12debd9_1 python-dateutil 2.8.2 pyhd3eb1b0_0 python_abi 3.9 2_cp39 conda-forge pytz 2021.3 pyhd3eb1b0_0 pyzmq 22.3.0 py39h295c915_2 readline 8.1.2 h7f8727e_1 requests 2.27.1 pyhd3eb1b0_0 send2trash 1.8.0 pyhd3eb1b0_1 setuptools 58.0.4 py39h06a4308_0 six 1.16.0 pyhd3eb1b0_1 sniffio 1.2.0 py39h06a4308_1 sqlite 3.38.0 hc218d9a_0 stack_data 0.2.0 pyhd3eb1b0_0 terminado 0.13.1 py39h06a4308_0 testpath 0.5.0 pyhd3eb1b0_0 texlab 2.2.2 hd9586b0_0 conda-forge tk 8.6.11 h1ccaba5_0 toml 0.10.2 pyhd3eb1b0_0 tomlkit 0.9.2 pyhd3eb1b0_0 tornado 6.1 py39h27cfd23_0 traitlets 5.1.1 pyhd3eb1b0_0 typing-extensions 3.10.0.2 hd3eb1b0_0 typing_extensions 3.10.0.2 pyh06a4308_0 tzdata 2021e hda174b7_0 urllib3 1.26.8 pyhd3eb1b0_0 wcwidth 0.2.5 pyhd3eb1b0_0 webencodings 0.5.1 py39h06a4308_1 websocket-client 0.58.0 py39h06a4308_4 wheel 0.37.1 pyhd3eb1b0_0 xz 5.2.5 h7b6447c_0 yarn 1.22.17 ha770c72_0 conda-forge zeromq 4.3.4 h2531618_0 zipp 3.7.0 pyhd3eb1b0_0 zlib 1.2.11 h36c2ea0_1013 conda-forge conda env: name: jupyterlab-extension-dev channels: - conda-forge - defaults dependencies: - _libgcc_mutex=0.1=conda_forge - _openmp_mutex=4.5=1_gnu - anyio=3.5.0=py39h06a4308_0 - argon2-cffi=21.3.0=pyhd3eb1b0_0 - argon2-cffi-bindings=21.2.0=py39h7f8727e_0 - asttokens=2.0.5=pyhd3eb1b0_0 - attrs=21.4.0=pyhd3eb1b0_0 - babel=2.9.1=pyhd3eb1b0_0 - backcall=0.2.0=pyhd3eb1b0_0 - bleach=4.1.0=pyhd3eb1b0_0 - brotlipy=0.7.0=py39h27cfd23_1003 - ca-certificates=2021.10.8=ha878542_0 - certifi=2021.10.8=py39hf3d152e_1 - cffi=1.15.0=py39hd667e15_1 - charset-normalizer=2.0.4=pyhd3eb1b0_0 - chktex=1.7.6=he28a2e2_0 - cryptography=36.0.0=py39h9ce1e76_0 - debugpy=1.5.1=py39h295c915_0 - decorator=5.1.1=pyhd3eb1b0_0 - defusedxml=0.7.1=pyhd3eb1b0_0 - deprecation=2.1.0=pyhd3eb1b0_0 - docutils=0.18.1=py39h06a4308_2 - entrypoints=0.3=py39h06a4308_0 - executing=0.8.3=pyhd3eb1b0_0 - html5lib=1.1=pyhd3eb1b0_0 - icu=69.1=h9c3ff4c_0 - idna=3.3=pyhd3eb1b0_0 - importlib-metadata=4.8.2=py39h06a4308_0 - importlib_metadata=4.8.2=hd3eb1b0_0 - iniconfig=1.1.1=pyhd3eb1b0_0 - ipykernel=6.9.1=py39h06a4308_0 - ipython=8.1.1=py39h06a4308_0 - ipython_genutils=0.2.0=pyhd3eb1b0_1 - jedi=0.18.1=py39h06a4308_1 - jinja2=3.0.2=pyhd3eb1b0_0 - json5=0.9.6=pyhd3eb1b0_0 - jsonschema=3.2.0=pyhd3eb1b0_2 - jupyter-lsp=1.5.1=pyhd8ed1ab_0 - jupyter-packaging=0.11.1=pyhd8ed1ab_0 - jupyter_client=7.1.2=pyhd3eb1b0_0 - jupyter_core=4.9.2=py39h06a4308_0 - jupyter_server=1.13.5=pyhd3eb1b0_0 - jupyterlab=3.3.1=pyhd8ed1ab_0 - jupyterlab-lsp=3.10.0=pyhd8ed1ab_0 - jupyterlab_pygments=0.1.2=py_0 - jupyterlab_server=2.10.3=pyhd3eb1b0_1 - ld_impl_linux-64=2.35.1=h7274673_9 - libffi=3.3=he6710b0_2 - libgcc-ng=11.2.0=h1d223b6_12 - libgomp=11.2.0=h1d223b6_12 - libsodium=1.0.18=h7b6447c_0 - libstdcxx-ng=11.2.0=he4da1e4_12 - libuv=1.43.0=h7f98852_0 - libzlib=1.2.11=h36c2ea0_1013 - markupsafe=2.0.1=py39h27cfd23_0 - matplotlib-inline=0.1.2=pyhd3eb1b0_2 - mistune=0.8.4=py39h27cfd23_1000 - nbclassic=0.3.5=pyhd3eb1b0_0 - nbclient=0.5.11=pyhd3eb1b0_0 - nbconvert=6.3.0=py39h06a4308_0 - nbformat=5.1.3=pyhd3eb1b0_0 - ncurses=6.3=h7f8727e_2 - nest-asyncio=1.5.1=pyhd3eb1b0_0 - nodejs=17.4.0=h8ca31f7_0 - notebook=6.4.8=py39h06a4308_0 - openssl=1.1.1l=h7f98852_0 - packaging=21.3=pyhd3eb1b0_0 - pandocfilters=1.5.0=pyhd3eb1b0_0 - parso=0.8.3=pyhd3eb1b0_0 - pexpect=4.8.0=pyhd3eb1b0_3 - pickleshare=0.7.5=pyhd3eb1b0_1003 - pip=21.3.1=pyhd8ed1ab_0 - pluggy=1.0.0=py39h06a4308_0 - prometheus_client=0.13.1=pyhd3eb1b0_0 - prompt-toolkit=3.0.20=pyhd3eb1b0_0 - ptyprocess=0.7.0=pyhd3eb1b0_2 - pure_eval=0.2.2=pyhd3eb1b0_0 - py=1.11.0=pyhd3eb1b0_0 - pycparser=2.21=pyhd3eb1b0_0 - pygments=2.11.2=pyhd3eb1b0_0 - pyopenssl=22.0.0=pyhd3eb1b0_0 - pyparsing=3.0.4=pyhd3eb1b0_0 - pyrsistent=0.18.0=py39heee7806_0 - pysocks=1.7.1=py39h06a4308_0 - pytest=6.2.5=py39h06a4308_2 - pytest-check-links=0.5.2=pyhd8ed1ab_0 - python=3.9.7=h12debd9_1 - python-dateutil=2.8.2=pyhd3eb1b0_0 - python_abi=3.9=2_cp39 - pytz=2021.3=pyhd3eb1b0_0 - pyzmq=22.3.0=py39h295c915_2 - readline=8.1.2=h7f8727e_1 - requests=2.27.1=pyhd3eb1b0_0 - send2trash=1.8.0=pyhd3eb1b0_1 - setuptools=58.0.4=py39h06a4308_0 - six=1.16.0=pyhd3eb1b0_1 - sniffio=1.2.0=py39h06a4308_1 - sqlite=3.38.0=hc218d9a_0 - stack_data=0.2.0=pyhd3eb1b0_0 - terminado=0.13.1=py39h06a4308_0 - testpath=0.5.0=pyhd3eb1b0_0 - texlab=2.2.2=hd9586b0_0 - tk=8.6.11=h1ccaba5_0 - toml=0.10.2=pyhd3eb1b0_0 - tomlkit=0.9.2=pyhd3eb1b0_0 - tornado=6.1=py39h27cfd23_0 - traitlets=5.1.1=pyhd3eb1b0_0 - typing-extensions=3.10.0.2=hd3eb1b0_0 - typing_extensions=3.10.0.2=pyh06a4308_0 - tzdata=2021e=hda174b7_0 - urllib3=1.26.8=pyhd3eb1b0_0 - wcwidth=0.2.5=pyhd3eb1b0_0 - webencodings=0.5.1=py39h06a4308_1 - websocket-client=0.58.0=py39h06a4308_4 - wheel=0.37.1=pyhd3eb1b0_0 - xz=5.2.5=h7b6447c_0 - yarn=1.22.17=ha770c72_0 - zeromq=4.3.4=h2531618_0 - zipp=3.7.0=pyhd3eb1b0_0 - zlib=1.2.11=h36c2ea0_1013 prefix: /home/user/.conda/envs/jupyterlab-extension-dev
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Browser Output (recommended for all interface issues)
Paste the output from your browser JavaScript console replacing the text in here.To learn how to open the developer tools in your browser: https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools#How_to_open_the_devtools_in_your_browser If too many messages accumulated after many hours of working in JupyterLab, consider refreshing the window and then reproducing the bug to reduce the noise in the logs.
Have you been able to reproduce these issues in any other LSP clients (e.g. vscode, vim)?
It could also be that some of these issue have been solved in subsequent versions of texlab: I'm also the maintainer of those on conda-forge, and will try to get an updated version out, though it might be the weekend, if it's tricky: i'm not a particularly sharp rust user.
I've tried vscode, which works without issue using texlab-vscode (which is using TexLab v3.3.2).
Using the precompiled Linux binary for TexLab v3.3.2 instead of installing from conda also runs into the same problem, so I assumed it was a jupyterlab-lsp issue. It's not time sensitive, just glad to know it's being looked into, thanks
welp, we have 3.3.2 on conda-forge now, so at least there's that.
as to 50: i don't know. if you clear the suggestion, and re-trigger does it show new ones? do other languages (e.g. python, r) behave the way you'd expect or exhibit the same (lack of) behavior?
Nice! And yes, clearing the suggestion and pressing tab will give new ones.
Hmm, I've only just tested it with python, but I think this is the issue. The Python language server seems to sends every possible suggestion for what it thinks you want. Thus it doesn't need to refresh each keystroke. But because there's little context to work off of in LaTeX, and a lot of macros, TexLab would end up sending far too many suggestions and thus wouldn't be performant. Reading up on TexLab, they've specifically limited it to 50 suggestions, expecting a re-request on each keystroke, which is never sent, because the other language servers probably just send everything.
Could be wrong, but that's what it looks like...
Thank you for the investigation @ZX-80.
The Python language server seems to sends every possible suggestion for what it thinks you want. Thus it doesn't need to refresh each keystroke. But because there's little context to work off of in LaTeX, and a lot of macros, TexLab would end up sending far too many suggestions and thus wouldn't be performant. Reading up on TexLab, they've specifically limited it to 50 suggestions, expecting a re-request on each keystroke, which is never sent, because the other language servers probably just send everything.
Does it send isIncomplete set to true? If it does, then this is error on our side, if it does not, then we are good and it is the TexLab's fault.
This is one of the annoying parts of LSP spec, see the long discussion in https://github.com/microsoft/language-server-protocol/issues/898.
It appears to in completion.rs, though I'd have to figure out how to get it's debug output when running under jupyterlab-lsp to actually see what it's doing