
A few days ago, I wrote a story Are you still using JupyterLab? and I got an amazing response. Readers pointed me to various new IDEs that are being developed for Data Science, but one of them stood out.
Michal Krassowski left me a note about a project that he and other contributors have been working on. JupyterLab-LSP is a Language Server Protocol integration for JupyterLab. In short, it adds new superpowers to JupyterLab, like code navigation, hover suggestions, linters, autocomplete and rename. I am really excited about this one as it addresses most of the issues, where PyCharm is superior to JupyterLab.

Let’s take it for a test drive
Code linting and hoovering suggestions
After installing JupyterLab-LSP you will notice "Fully initialized" icon in the status bar. This means that JupyterLab-LSP is working.
Code linting works great. In the example below, It shows "imported by unused" warning.

Code Completion
This one is one of the most anticipated features for me. Let’s test it.
Code Completion (CC) didn’t work for pandas or numpy as can be seen in a video below. I also tried CC with columns in pandas DataFrame, but it wasn’t any different. CC did work great with system libraries and with classes I’ve defined.

Function Signature Suggestion
Some pandas functions take many arguments, some of which I rarely use. Each time I use such function, I have to google for documentation to refresh my mind about it.
JupyterLab-LSP adds Function Signature Suggestions (FSS), which works great. You get a nice popup – not too intrusive, just right.

FSS could be further improved by highlighting the current argument that you are editing, like deoplete-jedi plugin in NeoVim.

Function Signature Suggestions works great, but there is a still room for improvement
Diagnostic panel
JupyterLab-LSP has also a nice diagnostic panel that lists all the warning and error. This is really useful as red underlinings may be overlooked from time to time.

Renaming variables
I was a bit disappointed with this one as I thought it will do refactoring, but it is a keyword replacement. I tried to refactor a variable name, but it also renamed a string as can be seen in a video below.

Other features
JupyterLab-LSP is packed with useful features, like Go to Definition – would you like to see how pandas DataFrame works behind the scenes – just use Go to Definition.
Code formatting will be a part of the LSP extension at some point too!
Would you like to see how pandas DataFrame works behind the scenes – just use Go to Definition
Try it by yourself
Make sure you have the latest JupyterLab installed – 2.1.0 at the time of writing. You also need to enable Extension Manager in JupyterLab.
pip install -U jupyterlab
Install LSP server extension:
pip install jupyter-lsp
Install node (command is for macOS):
brew install nodejs
Install frontend extension:
jupyter labextension install @krassowski/jupyterlab-lsp
Install LSP servers for Programming languages:
pip install 'python-language-server[all]'
Start jupyterlab and you should see "Fully initialized" icon in the status bar.
The Verdict

By the positive comments, I’ve made, you might be thinking that I will be using JuypterLab 2.0 with LSP daily. You would be surprised to know that I’ve actually installed the older version right after I finished this story. Why is that?
While new features work great, other extensions that I use do not support JupyterLab 2.0 yet. Those are jupyterlab-vim for Vi keybindings and jupyterlab_code_formatter for code formating. These two extensions are at the moment more important to me than LSP support. Maybe we can have the best of both worlds as it seems that JupyterLab-LSP supports also JupyterLab 1.x, but I haven’t tried it yet.
# for JupyterLab 1.x
jupyter labextension install @krassowski/[email protected]
In short, JupyterLab-LSP is a huge improvement and I can say I am going to be using it for sure in the future
Let’s connect
Talk: Book a call Socials: YouTube 🎥 | LinkedIn | Twitter Code: GitHub