Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing the project file as environment. #227

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/SymbolServer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
12 changes: 12 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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