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. For the language
servers in the tables below, use one of the suggested package managers to
install them: these implementations are tested to work with jupyter-lsp
.
If you do not see a language you would like, but can find it one of these lists:
...you might be able to add it via configuration or build your own spec for the server in question.
import pathlib
import IPython
from jinja2 import Template
from jupyter_lsp import LanguageServerManager
mgr = LanguageServerManager(extra_node_roots=[str(pathlib.Path.cwd().parent)])
mgr.init_language_servers()
def lang_server_table(specs):
return IPython.display.HTML(
Template(
"""
<table class="langservers">
<thead>
<tr>
<th>Languages</th>
<th>Implementation</th>
<th>Installation</th>
</tr>
</thead>
<tbody>
{% for key, spec in specs.items() %}
<tr>
<th>
{% for lang in spec.languages %}
<a name="language-{{lang}}"/>{{ lang }}<br/>
{% endfor %}
</th>
<td>
<a href="{{spec.urls.home}}">{{key}}</a>
</td>
<td>
<ul>
{% for pkgmgr, inst in spec.install.items() %}
<li>{{pkgmgr}}: <code>{{ inst }}</code></li>
{% endfor %}
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
"""
).render(specs=specs)
)
These servers have well-tested support for notebooks and file editors.
nb_langs = ["pyls", "r-languageserver"]
lang_server_table(
{key: spec for key, spec in mgr.language_servers.items() if key in nb_langs}
)
These servers have mostly been tested with file editors.
lang_server_table(
{
key: spec
for key, spec in mgr.language_servers.items()
if "npm" in spec["install"]
}
)
A number of language servers are built on the
reference implementation,
powered by NodeJS. The most reliable place to install these is in a
node_modules
in the directory where you launch jupyter lab
.
For example, to install all the servers which are tested as part of
jupyterlab-lsp
:
jlpm add --dev \
bash-language-server \
vscode-css-languageserver-bin \
dockerfile-language-server-nodejs \
vscode-html-languageserver-bin \
javascript-typescript-langserver \
vscode-json-languageserver-bin \
yaml-language-server
This will create create (or add to):
package.json
(check this in!)yarn.lock
(check this in!)node_modules/
(add to your VCS ignore file)If you wish to install these someplace else, you may need to specify where you install them with extra_node_roots.
These servers have been mostly tested with file editor.
sci_langs = ["texlab"]
lang_server_table(
{key: spec for key, spec in mgr.language_servers.items() if key in sci_langs}
)
conda install -y conda-forge tectonic texlab chktex
This will install:
tectonic
, a cross-platform $\LaTeX$ processing tooltexlab
, a Language Server for .tex
files that supports completion and
refernce navigationchktex
, a .tex
style checker%%html
<style>
table.langservers thead th {
text-align: center !important;
}
table.langservers tbody td,
table.langservers tbody th {
text-align: left !important;
}
</style>