Can’t make VSCode aware of a local package

If I do as follows, VSCode works as expected – i.e., I can click and go to definition of an exported function from my script and the files defining these functions are parsed correctly, etc. – however, this is not ideal since during active development the module files are modified and I need to restart the REPL session because Revise doesn’t pick up on the changes of included modules:

include("module_file.jl")
using .MyModule

If I include MyModule as a package via using MyModule, Revise can pickup the changes; however, now VSCode doesn’t parse the module files and doesn’t let me click&go to definition.

Is there a way to make VSCode parse a local package/module?

Personally, I use a second environment to dev my own packages (modules). I usually keep this second environment in a subfolder of the main package. Using the dev mode is simple, instead of doing ] add path/to/package, you write ] dev path/to/package. This also plays well with revise and the built in REPL. This allows you to skip the include of your own module and just add the using.

If you want to do it in completely separate folders, I would recommend opening up each project (or environment) under the same VS code workspace, so you have access to all the files and it makes navigating between the projects easier and the extensions seem to work better too.

2 Likes

Thanks for the idea @jmair, I switch the Julia extension of my VSCode to “insider” version and now everything works as expected with using MyModule – Revise picks up changes, VSCode lets me go to definition and shows the documentation. It might have been a bug with the julia-vscode-language-server :person_shrugging:

1 Like