Language server not starting for custom language type
See original GitHub issueHi. Firstly jupyter-lsp is an awesome project.
Description
I’m struggling to get my custom language server to actually start when editing my custom language.
What’s particularly strange is, it starts without an issue if I configure it to work with python. I just can’t get it to start when I’m using my custom kernel.
I wonder if you could help me work around this issue? I’ve looked at all the existing issues and get the impression there might be ambiguity around how languages are discovered (eg. https://github.com/krassowski/jupyterlab-lsp/issues/190, https://github.com/robocorp/robotframework-lsp/issues/13).
Thanks in advance.
Steps to reproduce
$ mkdir test
test/kernel.json:
{
"argv": ["python", "-m",
"testkernel", "-f",
"{connection_file}"],
"display_name": "test",
"name": "test",
"language": "test"
}
$ jupyter kernelspec install --user test
testkernel.py:
from ipykernel.kernelbase import Kernel
class TestKernel(Kernel):
implementation = 'test'
implementation_version = '2'
banner = "Test banner"
language_version = '2'
language = 'test'
language_info = {
'mimetype': 'text/x-test',
'name': 'test'
}
def do_execute(self, code, silent, store_history=True, user_expressions=None, allow_stdin=False):
if not silent:
stream_content = {'name': 'stdout', 'text': code}
self.send_response(self.iopub_socket, 'stream', stream_content)
return {'status': 'ok',
'execution_count': self.execution_count,
'payload': [],
'user_expressions': {},
}
if __name__ == '__main__':
from ipykernel.kernelapp import IPKernelApp
IPKernelApp.launch_instance(kernel_class=TestKernel)
~/.jupyter/jupyter_notebook_config.py (put any language server in the argv here if desired)
c.LanguageServerManager.language_servers = {
"test-language-server": {
"version": 2,
"argv": ["touch", "language-server-started"],
"languages": ["test"],
"mime_types": [
"text/x-test",
]
}
}
Findings
When a new notebook is made with the Test kernel, the kernel works as expected. However the langauge server doesn’t start up.
Logs
jupyter lab --log-level=DEBUG
[D 09:32:58.078 LabApp] [lsp] The following Language Servers will be available: {
"test-language-server": {
"argv": [
"touch",
"language-server-started"
],
"languages": [
"test"
],
"mime_types": [
"text/x-test"
],
"version": 2
}
}
[D 10:17:15.959 LabApp] Received kernel info: {'status': 'ok', 'protocol_version': '5.3', 'implementation': 'test', 'implementation_version': '2', 'language_info': {'mimetype': 'text/x-test', 'name': 'test'}, 'banner': 'Test banner', 'help_links': []}
Enironment
Running in latest scipy-notebook docker. Using conda for package management.
jupyter-lsp 0.9.2
jupyterlab 2.2.8
Issue Analytics
- State:
- Created 3 years ago
- Comments:28 (11 by maintainers)
Top GitHub Comments
Just after typing the above I realized I been just looking at the config files. I added the file_extension into the language_info returned by the Kernel and things connected.
The language server is implemented in scala, using LSP4J as a base (similiar to scala meta https://github.com/krassowski/jupyterlab-lsp/issues/17). At the moment I only have hover implemented but it looks like it works well with jupyter-lsp.