Enhanced autocompletion in Julia, R and Python (LSP)

With gradual progress jupyterlab-lsp arrived at a place when we can show off this simple gif with an LSP-driven autocompletion working across Julia, Python and R:

It’s a small thing, but hopefully will make the user-experience better.

I hope to submit a JEP pre-proposal to make it an official Jupyter subproject soon :slight_smile:



Recently I have created a new virtual environment with Anaconda on a Windows 11 PC, in which I installed Jupyterlab 3.4.3 together with python-lsp-server. While jupyterlab is running, an error appears in the log all of the time and autocompletion etc. stops working in jupyterlab. I copied the relevant excerpt from the log below, which shows the exception that is thrown:

[E 2022-06-14 14:49:47.157 ServerApp] <LspStdIoWriter(parent=<LanguageServerSession(language_server=pylsp, argv=[‘C:\Users\Tom\anaconda3\envs\engineering-22-06\python.exe’, ‘-m’, ‘pylsp’])>)> couldn’t write message: Content-Length: 266

Traceback (most recent call last):
  File "C:\Users\Tom\anaconda3\envs\engineering-22-06\lib\site-packages\jupyter_lsp\stdio.py", line 193, in write
    await convert_yielded(self._write_one(response.encode("utf-8")))
  File "C:\Users\Tom\anaconda3\envs\engineering-22-06\lib\asyncio\futures.py", line 284, in __await__
    yield self  # This tells Task to wait for completion.
  File "C:\Users\Tom\anaconda3\envs\engineering-22-06\lib\asyncio\tasks.py", line 304, in __wakeup
  File "C:\Users\Tom\anaconda3\envs\engineering-22-06\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\Users\Tom\anaconda3\envs\engineering-22-06\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\Tom\anaconda3\envs\engineering-22-06\lib\site-packages\jupyter_lsp\stdio.py", line 201, in _write_one
OSError: [Errno 22] Invalid argument

After trying out Kite and Tabnine, I really appreciate the code completion and other stuff that python-lsp-server offers. So I hope that someone knows how this error can be fixed. I found that when I click the refresh button of the browser, the lsp-server gets active again, but after a short while the error comes up again.

From the error description it can be deduced that the error happens when method textDocument/documentHighlight is called. After disabling “Code Highlights” in Jupyterlab Settings,
the error hasn’t happened anymore.

I was happy too soon, the error can also happen when other methods are called.


1 Like

Hi @TomLXXVI would you mind filling out a bug report template on GitHub: GitHub - jupyter-lsp/jupyterlab-lsp: Coding assistance for JupyterLab (code navigation + hover suggestions + linters + autocompletion + rename) using Language Server Protocol?

Since recently, the bug doesn’t show up anymore. I think that a recent Windows update solved the issue for me.

1 Like

I have a similar error with all operating system updates. The error occurs some time after the start of work. And Lsp server stops working. I don’t understand how to fix it.