Language Server Protocol integration for Jupyter(Lab)
This project is in its early days, but you are welcome to check it out, leave feedback and/or a PR
Examples below are for Python, but work for R as well
Hover over any piece of code; if an underline appears, you can press Ctrl to get a tooltip with function/class signature, module documentation or any other piece of information that the language server provides
Critical errors have red underline, warnings are orange, etc. Hover over the underlined code to see a more detailed message
Jump to Definition
Use the context menu entries to jump to definitions
Place your cursor on a variable, function, etc and all the usages will be highlighted
Certain characters, for example '.' (dot) in Python, will automatically trigger completion
Automatic Signature Suggestions
Function signatures will automatically be displayed
Advanced static-analysis autocompletion without a running kernel
When a kernel is available the suggestions from the kernel (such as keys of a dict and columns of a DataFrame autocompletion) are merged with the suggestions from the Language Server (currently only in notebook).
- JupyterLab >=1.1,<1.2
- Python 3.5+
- nodejs 8+
For the current stable version:
install the server extension:
pip install --pre jupyter-lsp
install the frontend extension:
jupyter labextension install @krassowski/jupyterlab-lsp
pip install python-language-server[all] R -e 'install.packages("languageserver")'
conda install -c conda-forge python-language-server r-languageserver
Please see our full list of supported language servers which includes installation hints for the common package managers (npm/pip/conda). In general, any LSP server from the Microsoft list should work after some additional configuration.
Note: it may be worth visiting the repository of each server you install as many provide additional configuration options.
(Optional, Linux/OSX-only) to enable opening files outside of the root directory (the place where you start JupyterLab), create
.lsp_symlinkand symlink your
/home, or any other location which includes the files that you wish to make possible to open in there:
mkdir .lsp_symlink cd .lsp_symlink ln -s /home home
If your user does not have sufficient permissions to traverse the entire path, you will not be able to open the file. A more detailed guide on symlinking (written for a related jupyterlab-go-to-definition extension) is available here.
To update previously installed extensions:
pip install -U jupyter-lsp jupyter labextension update @krassowski/jupyterlab-lsp
Getting the latest alpha/beta/RC version
install command (update does not seem to work) appending
@<0.x.y.rc-z> to the
extension name, like this:
jupyter labextension install @firstname.lastname@example.org
This would not be possible without the fantastic initial work at wylieconlon/lsp-editor-adapter.