# Using Julia LSP with Jupyter Lab and environments

**URL:** <https://discourse.julialang.org/t/using-julia-lsp-with-jupyter-lab-and-environments/116362>\
**Category:** Jupyter-Notebook\
**Tags:** languageserver\
**Created:** [June 28, 2024, 3:06pm UTC](https://discourse.julialang.org/t/using-julia-lsp-with-jupyter-lab-and-environments/116362 "2024-06-28T15:06:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joh11](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joh11/32/23140_2.png) [@Joh11](https://discourse.julialang.org/u/Joh11)\
**Post date:** [June 28, 2024, 3:06pm UTC](https://discourse.julialang.org/t/using-julia-lsp-with-jupyter-lab-and-environments/116362/1 "2024-06-28T15:06:56Z")

</div>

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:

```julia
# 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](https://discourse.julialang.org/t/jupyter-lab-lsp-argv-path/48115/2), putting in a file `jupyter_server_config.json`:

```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,

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [June 29, 2024, 2:12am UTC](https://discourse.julialang.org/t/using-julia-lsp-with-jupyter-lab-and-environments/116362/2 "2024-06-29T02:12:52Z")

</div>

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.
