diff --git a/src/SymbolServer.jl b/src/SymbolServer.jl index 985acb93..1bc62afa 100644 --- a/src/SymbolServer.jl +++ b/src/SymbolServer.jl @@ -28,7 +28,7 @@ function getstore(ssi::SymbolServerInstance, environment_path::AbstractString, p # see if we can download any package cache's before if download - manifest_filename = isfile(joinpath(environment_path, "JuliaManifest.toml")) ? joinpath(environment_path, "JuliaManifest.toml") : joinpath(environment_path, "Manifest.toml") + manifest_filename = toml_path(environment_path, Base.manifest_names) if isfile(manifest_filename) let manifest = read_manifest(manifest_filename); if manifest !== nothing asyncmap(collect(validate_disc_store(ssi.store_path, manifest)), ntasks = 10) do pkg @@ -131,7 +131,7 @@ function getstore(ssi::SymbolServerInstance, environment_path::AbstractString, p end function load_project_packages_into_store!(ssi::SymbolServerInstance, environment_path, store) - project_filename = isfile(joinpath(environment_path, "JuliaProject.toml")) ? joinpath(environment_path, "JuliaProject.toml") : joinpath(environment_path, "Project.toml") + project_filename = toml_path(environment_path, Base.project_names) project = try Pkg.API.read_project(project_filename) catch err @@ -143,7 +143,7 @@ function load_project_packages_into_store!(ssi::SymbolServerInstance, environmen end end - manifest_filename = isfile(joinpath(environment_path, "JuliaManifest.toml")) ? joinpath(environment_path, "JuliaManifest.toml") : joinpath(environment_path, "Manifest.toml") + manifest_filename = toml_path(environment_path, Base.manifest_names) manifest = read_manifest(manifest_filename) manifest === nothing && return diff --git a/src/utils.jl b/src/utils.jl index 36b26d80..0a020634 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -616,3 +616,15 @@ function write_depot(server::Server, ctx, written_caches) !isempty(written_path) && push!(written_caches, written_path) end end + +function toml_path(p, candidates) + if isfile(p) && basename(p) in candidates + return p + elseif isdir(p) + for c in candidates + pc = joinpath(p, c) + isfile(pc) && return pc + end + end + return nothing +end