I finally found a solution that works good enough for me. I still had to create a separate package for each module, but could at least have them all in the same git repo. Here is how I did it:
Create an empty git repo inside a new folder (this is assuming your
MyPackages folder isn’t already a git repo):
and then inside this folder create your packages:
julia> using PkgTemplates
# now customise the `dir` to "." to create the repo inside "MyPackages"
now you can delete the git repo that
PkgTemplates created for you and only
keep the rest of the stuff:
rm -rf PackageA/.git
rm -rf PackageA/.github
and lets also edit the contents of
PackageA/src/PackageA.jl to contain something, i.e.
testa() = println("Hello to Package A")
end # module
Now we can tell julia about the existence of your great new
PackageA by doing
pkg> dev ~/MyPackages/PackageA
julia> using PackageA
# should output "Hello to Package A"
To add more packages to
MyPackages just repeat everything after the second
step with the new package names.
And finally, make sure that the neovim LSP uses the global project instead
of any silly local stuff. For this, edit the file
(or wherever else neovims language server config for julia is stored)
to define the project path as follows (with the 2nd option importantly commented out!)
project_path = let
## 1. Finds an explicitly set project (JULIA_PROJECT)
p = get(ENV, "JULIA_PROJECT", nothing);
p === nothing ? nothing : isempty(p) ? nothing : p
## 2. Look for a Project.toml file in the current working directory,
## or parent directories, with $HOME as an upper boundary
# Base.current_project(), # deleted this myself. Might be the thing!
## 3. First entry in the load path
get(Base.load_path(), 1, nothing),
## 4. Fallback to default global environment,
## this is more or less unreachable
I am sure for the last part one could also edit ones
.vimrc instead of
julials.lua, but that is beyond my (neo)vim expertise.