VS Code Julia Language Server Indexing

Hi,

I had installed the Julia extension awhile ago. But every time I used it, it stalls at indexing and never ends. The indexing consumes CPU sources.

Julia extension 0.15.40 on Ubuntu 16.04

Thank you for your help!

How long have you waited for it to end? It can take some considerable amount of time if you have a lot of packages (how large is your Project.toml file?).

Does the status bar update itself as it indexes through the packages? Or is it stuck at a particular package (like say BioAlignments).

1 Like

Hi, it never ends indexing. At least for the couple hours I am using the VS code. Where can I look for the Project.toml? Yes. It always stuck at the BioAlignments.

If you are developing a package, I would suggest only use the local environment in the project. From your screenshot I can see it is indexing your global environment. So it takes long. Consider adding this to your startup.jl?

using Pkg

if isfile("Project.toml")
    Pkg.activate(".")
end

Open VSCode directly from that folder where Project.toml locates, then VSCode will use the local environment per project.

2 Likes

I don’t think that’s the problem since apparently it’s stuck at a single package. Maybe it does take long to index that package but definitely not a few hours.

Could you show the “Output” tab of the “Language Server Extension”

It has no progress at least for 2 hours.

I can reproduce the same behavior on Ubuntu 20.04. For me, VSCode gets stuck in DataFrames.jl or DifferentialEquations.jl.

Do any of you have Revise.jl in your Project.toml file? Sometimes Revise can prevent indexing… If I were you, I’d just delete the .julia folder, and start again (copy your Project.toml folder so you don’t have to manually enter in all the packages – but make sure to remove the Revise.jl entry).

I had the same problem on Lubuntu 20.04. For me, VS Code gets stuck in DifferentialEquations.jl at first time, and RCall.jl at the next.

I found a workaround, though it is not a smart way at all: letting Language Server be indexing on another environment which has less packages as follows.

julia> using Pkg
julia> Pkg.generate("DummyPackageForIndexing")
 Generating  project DummyPackageForIndexing:
...
(@v1.4) pkg> activate ./DummyPackageForIndexing/
...
(DummyPackageForIndexing) pkg> add DifferentialEquations
...
(DummyPackageForIndexing) pkg>

then, click “Julia env” on the (bottom left) status bar of VSCode, pick the created folder(in this case, “DummyPackageForIndexing”) to select the environment.
After that, Julia Language Server starts indexing the package added to the local environment, but it finishes much faster than in the previous case.
(So it seems that indexing packages got stuck in the previous case.)

Once Language Server finished indexing all the package added to a local environment, indexing the packages doesn’t happen either on the environment or the other environments including my global environment.

In this ways, I got able to use Intellisence to all the packages I had added on the global environment, including Revise.jl.
But I had to repeat the process to each package I had added to the global environment.

For your information.

1 Like

I don’t know where mine stucks, but it’s stucking all the times. Once it was consuming all my 32 GB of RAM.

It seems that the Julia extension of VS code always has this problem. Hope the team will fix this.

I reinstalled Julia since I could not get the problem fixed. So far (~a month of usage and with a handful of package installed), I did not get the same issue. But I don’t know whether it will come up again…

I’m having a similar problem it doesn’t mention any packages, just says indexing Juila, and I get a notice that Julia crashed.

It’s indexing your entire Julia 1.5 global packages, as shown in lower left corner.

Do I just wait then? I had an error message, if you check my new post, it still says it’s indexing, and that it crashed, but now the things I’m trying to do work, and I’m not getting any error messages.

My suggestion is that if you are developing a package, or run in a local directory, select the environment of that local directory, which usually has limited packages to index so it will be faster.

Not sure what you mean about developing a package, but I am out in the country with a cell phone connection.

I don’t think it has something to do with your connection? Everything should be done locally. When I say “developing a package”, I basically mean a project: https://julialang.github.io/Pkg.jl/v1/environments/#Creating-your-own-projects-1 and https://julialang.github.io/Pkg.jl/v1/glossary/

And each project can have an environment, use that environment. Not the global v1.5 one.

I had similar issues, which were apparently the result of using a custom sysimage. After running
PackageCompiler.restore_default_sysimage() , I don’t get that issue any more. As far as why/how that fixes the problem - someone much smarter than I would have to weigh in.

thought on this post by @Derek_Vetsch?

I would agree with @singularitti. I would not recommend opening up VS Code and firing up Julia - you want to open a folder in your workspace. If you look in the bottom left of your screenshot - you are using your entire Julia 1.5 environment. You want to create an environment in the folder you are working in using Pkg.activate. By doing that, Julia will only need to index the packages that you have added in your Project.toml file - which will go much faster.

1 Like