Using Julia LSP with Jupyter Lab and environments

Hi,

I am trying to make the Julia LSP work with Jupyter Lab. I managed to install it, however it is highlighting all of my packages with the “missing reference” warning, even with standard library modules:

# here lsp complains about `missing reference`
using LinearAlgebra 

My question is twofold. First, how to fix these missing references to the standard lib ? It is to note that the lsp works well for functions defined my notebook, I can jump to definition and so on.

Second, how to make the LSP use a specific environment (say, at ., the directory of the notebook) ? I tried to follow the solution here, putting in a file jupyter_server_config.json:

{
  "LanguageServerManager": {
    "language_servers": {
      "julia-languageserver": {
        "version": 3,
        "argv": ["julia", "--debug=yes", "--project=dir1", "-e", "using LanguageServer, LanguageServer.SymbolServer; runserver()", "."],
        "languages": ["julia"],
        "display_name": "LanguageServer.jl",
        "mime_types": ["text/julia", "text/x-julia"]
      }
    }
  }
}

Note that my notebook is in dir1/, as I am running jupyter lab in the parent directory.

However, it does not seem to work… Furthermore, It is here hardcoded in the json file, but I would like to be able to change it for different notebooks. For example, I have two directories dir1 and dir2, each with an environment (dir1/Project.toml and dir2/Project.toml). Jupyter Lab already select the right environment. It would be really nice if it could also be done automatically for the language server…

Thanks in advance,

1 Like

I don’t know how JupyterLab handles language server stuff, but I can tell you that this problem also happens in other editors trying to use the LS (eg neovim).

I’ve been looking for a solution myself, and though you can find some hacks, I haven’t been able to get it to work myself yet.