VS Code Intellisense for custom package

I’m developing a custom package which is located in some folder (other than .julia/packages/...). This package’s root folder added to JULIA_LOAD_PATH as:

export JULIA_LOAD_PATH=$HOME/local/packages:$JULIA_LOAD_PATH

It works as I expect, i.e. I can do using MyPackage in my scripts, but intellisense is not working in VS Code for my package as it works for standard packages.

How do I make my package visible to julia intellisense?

Thank you very much,

1 Like

Not sure if there is a better way, but I solved it by adding my package to standard (in .julia) Project.toml with
] dev <path to package>

2 Likes

Hi,

I’m having the same issue. I tried dev_ing the package in both the global environment and the environment I use for my main project, and updating the LOAD_PATH in startup.jl, and neither of those worked. Is there some other way to get VS Code to recognize a package? The code runs just fine, it’s just the autocomplete etc. that doesn’t work.

Run command “Julia: Restart Language Server” and see if your package is indexed (in Language Server output). Also try to re-index.

1 Like

Good idea, it seems like the problem is somewhere with the extension, here’s what I get:

 Warning: Some Julia code in the VS Code extension crashed with
│   e = InvalidStateException("Channel is closed.", :closed)
└ @ Main ~/.vscode/extensions/julialang.language-julia-1.1.37/scripts/error_handler.jl:5
ERROR: InvalidStateException("Channel is closed.", :closed)
Stacktrace:
 [1] try_yieldto(::typeof(Base.ensure_rescheduled)) at ./task.jl:656
 [2] wait at ./task.jl:713 [inlined]
 [3] wait(::Base.GenericCondition{ReentrantLock}) at ./condition.jl:106
 [4] take_buffered(::Channel{Any}) at ./channels.jl:387
 [5] take! at ./channels.jl:381 [inlined]
 [6] get_next_message(::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint,Base.PipeEndpoint}) at /Users/satvikberi/.vscode/extensions/julialang.language-julia-1.1.37/scripts/packages/JSONRPC/src/core.jl:197
 [7] macro expansion at /Users/satvikberi/.vscode/extensions/julialang.language-julia-1.1.37/scripts/packages/LanguageServer/src/languageserverinstance.jl:263 [inlined]
 [8] (::LanguageServer.var"#98#100"{LanguageServerInstance})() at ./task.jl:356

When I searched for similar errors it seems like this has been a recurring bug that hasn’t yet been solved, unfortunately.

I finally tried deleting ~/.julia and reinstalling, that did the trick!

1 Like