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.
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
It looks like vscode-julia plugin doesn’t recognize that macro:
┌ Error: Some Julia code in the VS Code extension crashed
└ @ VSCodeDebugger ~/.vscode/extensions/julialang.language-julia-1.37.2/scripts/error_handler.jl:15
ERROR: LoadError: UndefVarError: @enter not defined
Stacktrace:
[1] top-level scope
@ :0
That’s strange. I imagine you might need to reinstall VS code (and extensions), or possibly upgrade your julia installation (something like juliaup is good for this).
I have no experience with this breaking personally, even switching between the normal and insider versions of the extension.