Jupyter Lab LSP: argv path

I’d like to be able to use Julia’s language server within Jupyter Lab. There’s an extension for Jupyter Lab that adds LSP integration. There’s a list of languages that are well-supported by the extension, unfortunately Julia is not one of them. Fortunately, provided a language has a language server (which Julia, of course does), it may still be possible to use it within Jupyter Lab. A problem I’ve encountered is that I’m not entirely sure what path I should specify in the settings:

{
  "LanguageServerManager": {
    "language_servers": {
      "a-language-server-implementation": {
        "version": 1,
        "argv": ["/absolute/path/to/a-language-server", "--stdio"],
        "languages": ["a-language"]
      }
    }
  }
}

I have installed the “LanguageServer” Julia package on my Linux system (install directory is the usual ~/.julia/packages/LanguageServer). The docs say that argv is:

argv , a list of shell tokens to launch the server in stdio mode (as opposed to tcp )

I’m not entirely sure what this means for Julia, so could someone tell me what I need to put in argv.

In Unix systems you run commands such as ls -l or echo test. In the Python implementation of the command execution (jupyter-lsp is written in Python) those commands are split into tokens, forming lists of strings: such as ['ls', '-l'] and ['echo', 'test']. You need to provide the command that starts the Julia language server from command line, but split into such tokens.

The Julia language server GitHub says that at minimum it should be:
julia --project=/path/to/LanguageServer.jl/environment -e "using LanguageServer, LanguageServer.SymbolServer; runserver()" so you would set:

{
  "LanguageServerManager": {
    "language_servers": {
      "julia-language-server": {
        "version": 1,
        "argv": ["julia", "--project=/path/to/LanguageServer.jl/environment", "-e", "using LanguageServer, LanguageServer.SymbolServer; runserver()"],
        "languages": ["julia"]
      }
    }
  }
}

Have a look at the implementation in this tweet: https://twitter.com/sig_kdy/status/1237696242068500480/photo/1.

It would be great if you could open an issue on our GitHub so we can help you - I just stumbled here incidentally and if not a curiosity trip into the Julia adoption, I would not see this message ever otherwise. Also, the support for new languages does not just happen, someone needs to implement it so your input is more than welcome.

Please also see another attempt in this comment: NotebookAdapter.mime_type is undefined · Issue #313 · krassowski/jupyterlab-lsp · GitHub

The new 3.1 of jupyterlab-lsp now supports auto-detection of Julia Language Server (LanguageServer.jl) as an experimental feature:

Please do report any bugs and/or send pull requests to improve it :slight_smile:

@krassowski I’m using jupyterlab-lsp 3.4.1 along with LanguageServer.jl, autocompletion works but I get a lot of “missing reference” warnings inside the notebook:


Is there any workaround for solving this problem?

Could it be due to this bug in LanguageServer.jl: "Missing reference" on module imports which aren't missing · Issue #391 · julia-vscode/LanguageServer.jl · GitHub ?

PS. we released 3.5.0 this week, I hope you will like the improvements (Release v3.5.0 · krassowski/jupyterlab-lsp · GitHub).

Hello, I have some strange problems.
Now I have installed LSP 3.5.0 and LanguageServer.jl, but LSP cannot auto-detect it.
What should I do or what info should I show?

图片

The Chinese in this picture means “julia is hashed.”

Hi @fenyutanchan, could it be that your PATH is different when starting JupyterLab? Is it installed in conda base environment or somewhere else? Please see Julia LSP Server in default environment not auto-detected · Issue #512 · krassowski/jupyterlab-lsp · GitHub where we discussed a related, but possibly different issue; you will find a PATH modification that worked for the user who had the problem, and maybe it could also help in your case.

If it does not, please open a new issue in the GitHub repository, describing your configuration in more details, and ideally providing instructions on how to reproduce problematic environment in a few simple steps.