Skip to main content

Multi-Language Server WebSocket proxy for Jupyter notebook or lab server for Python 3.5+.

Project description

jupyter-lsp

Multi-Language Server WebSocket proxy for your Jupyter notebook or lab server. For Python 3.5+.

See the parent of this repository, jupyterlab-lsp for the reference client implementation for JupyterLab.

Installing language servers

jupyter-lsp does not come with any Language Servers! However, we will try to use them if they are installed and we know about them (you can disable this behavior by configuring autodetect).

Use a package manager to install a language server (also this list) from the tables below: these implementations are tested to work with jupyter-lsp.

language npm install (-g), or yarn/jlpm add (-g)
bash bash-language-server
css
less
sass
vscode-css-languageserver-bin
docker dockerfile-language-server-nodejs
html vscode-html-languageserver-bin
javascript
typescript
javascript-typescript-langserver
json vscode-json-languageserver-bin
markdown unified-language-server
yaml yaml-language-server
language conda install -c conda-forge language-specific package manager
python python-language-server pip install python-language-server
r r-languageserver Rscript -e 'install.packages("languageserver")'

Don't see an implementation for the language server you need? You can bring your own language server.

Please consider contributing your language server spec to jupyter-lsp!

Adding custom language servers

Jupyter config via traitlets

Like the Jupyter Notebook server, JupyterHub and other Jupyter interactive computing tools, jupyter-lsp can be configured via Python or JSON files in well-known locations. You can find out where to put them on your system with:

jupyter --paths

They will be merged from bottom to top, and the directory where you launch your notebook server wins, making it easy to check in to version control.

# ./jupyter_notebook_config.json                 ---------- unique! -----------
#                                               |                              |
# or e.g.                                       V                              V
# $PREFIX/etc/jupyter/jupyter_notebook_config.d/a-language-server-implementation.json
{
  "LanguageServerManager": {
    "language_servers": {
      "a-language-server-implementation": {
        "argv": ["/absolute/path/to/a-language-server", "--stdio"],
        "languages": ["a-language"]
      }
    }
  }
}

More complex configurations that can't be hard-coded may benefit from the python approach:

# jupyter_notebook_config.py
import shutil

# c is a magic, lazy variable
c.LanguageServerManager.language_servers = {
    "a-language-server-implementation": {
        # if installed as a binary
        "argv": [shutil.which("a-language-server")],
        "languages": ["a-language"]
    },
    "another-language-implementation": {
        # if run like a script
        "argv": [shutil.which("another-language-interpreter"), "another-language-server"],
        "languages": ["another-language"]
    }
}

Python entry_points

pip-installable packages in the same environment as the Jupyter notebook server can be automatically detected as providing a language server spec. These are a little more involved: see CONTRIBUTING.

Configuration Options

Like language_servers, these can be configured via jupyter_notebook_config.json (or .py) or via command line arguments to jupyter notebook or jupyter lab.

nodejs

default: autodetect

A custom absolute path to your nodejs executable.

autodetect

default: True

jupyter-lsp will look for all known language servers. User-configured language_servers of the same implementation will be preferred over autodetected ones.

node_roots

default: []

Absolute paths to search for node_modules, such as nodejs-backed language servers. The order is, roughly:

  • the folder where notebook or lab was launched
  • the JupyterLab staging folder
  • wherever conda puts global node modules
  • wherever some other conventions put it

extra_node_roots

default: []

Additional places jupyter-lsp will look for node_modules. These will be checked before node_roots

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyter-lsp-0.6.0b0.tar.gz (19.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page