I am doing some tests with Julia and VS Code to try and figure out why the Julia Extension doesn’t seem to be able to find definitions for some functions.
I wrote a short test file containing the following contents.
using Dates
using Base64
using DataFrames
using CSV
function (@main)(args)
println(Dates.today())
println(Base64.base64encode("helloworld"))
end
I opened this with Visual Studio Code. I can run it from the terminal by running
$ julia MyPackage/src/MyPackage.jl
The Julia environment, both within VS Code, and for the Julia process used to run MyPackage.jl is set to v1.11 / (@v1.11) pkg>.
If I hold down CTRL and hover over DataFrames or CSV, I am able to jump to the definitions of those modules.
For example, in the case of CSV, left clicking while holding CTRL opens
/home/user/.julia/packages/CSV/XLcqT/src/CSV.jl
Why doesn’t this work for the standard library packages such as Dates and Base64?
Is it expected to work? Does it work for anyone else?
I think that stdlibs should be expected to work like external packages in most regards (except that they are shipped with Julia itself so you don’t have to download them).
See also this discussion:
I think it depends in which environment Julia thinks you are in VSCode. And if you have selected @v1.11, you may need to explicitly add Dates to it (even though you can load it without that because it happens to be a stdlib)
I installed it with juliaup too, but I don’t think that’s the issue. However, VSCode autocompletion has always been a bit of a mystery to me, so I’m afraid my knowledge ends at the post I linked above ^^