Skip to content
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
![](https://github.com/julia-vscode/SymbolServer.jl/workflows/Run%20CI%20on%20master/badge.svg)
[![codecov.io](http://codecov.io/github/julia-vscode/SymbolServer.jl/coverage.svg?branch=master)](http://codecov.io/github/julia-vscode/SymbolServer.jl?branch=master)

SymbolServer is a helper package for LanguageServer.jl that provides information about internal and exported variables of packages (without loading them). A package's symbol information is initially loaded in an external process but then stored on disc for (quick loading) future use.
SymbolServer is a helper package for LanguageServer.jl that provides information about internal and exported variables of packages (without loading them). A package's symbol information is initially loaded in an external process but then stored on disk for (quick loading) future use.

## Installation and Usage
```julia
Expand Down
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CurrentModule = SymbolServer
![](https://github.com/julia-vscode/SymbolServer.jl/workflows/Run%20CI%20on%20master/badge.svg)
[![codecov.io](http://codecov.io/github/julia-vscode/SymbolServer.jl/coverage.svg?branch=master)](http://codecov.io/github/julia-vscode/SymbolServer.jl?branch=master)

SymbolServer is a helper package for LanguageServer.jl that provides information about internal and exported variables of packages (without loading them). A package's symbol information is initially loaded in an external process but then stored on disc for (quick loading) future use.
SymbolServer is a helper package for LanguageServer.jl that provides information about internal and exported variables of packages (without loading them). A package's symbol information is initially loaded in an external process but then stored on disk for (quick loading) future use.

## Installation and Usage

Expand Down
12 changes: 6 additions & 6 deletions src/SymbolServer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function getstore(ssi::SymbolServerInstance, environment_path::AbstractString, p
let manifest = read_manifest(manifest_filename)
if manifest !== nothing
@debug "Downloading cache files for manifest at $(manifest_filename)."
to_download = collect(validate_disc_store(ssi.store_path, manifest))
to_download = collect(validate_disk_store(ssi.store_path, manifest))
batches = Iterators.partition(to_download, max(1, floor(Int, length(to_download)÷50)))
for (i, batch) in enumerate(batches)
percentage = round(Int, 100*(i - 1)/length(batches))
Expand Down Expand Up @@ -138,7 +138,7 @@ function getstore(ssi::SymbolServerInstance, environment_path::AbstractString, p

if success(p)
# Now we create a new symbol store and load everything into that
# from disc
# from disk
new_store = recursive_copy(stdlibs)
load_project_packages_into_store!(ssi, environment_path, new_store, progress_callback)
@debug "SymbolStore: store success"
Expand Down Expand Up @@ -201,7 +201,7 @@ end
"""
load_package_from_cache_into_store!(ssp::SymbolServerInstance, uuid, store)

Tries to load the on-disc stored cache for a package (uuid). Attempts to generate (and save to disc) a new cache if the file does not exist or is unopenable.
Tries to load the on-disk stored cache for a package (uuid). Attempts to generate (and save to disk) a new cache if the file does not exist or is unopenable.
"""
function load_package_from_cache_into_store!(ssi::SymbolServerInstance, uuid::UUID, environment_path, manifest, store, progress_callback = nothing, percentage = missing)
yield()
Expand Down Expand Up @@ -234,7 +234,7 @@ function load_package_from_cache_into_store!(ssi::SymbolServerInstance, uuid::UU
end
catch err
Base.display_error(stderr, err, catch_backtrace())
@warn "Tried to load $pe_name but failed to load from disc, re-caching."
@warn "Tried to load $pe_name but failed to load from disk, re-caching."
try
rm(cache_path)
catch err2
Expand All @@ -244,12 +244,12 @@ function load_package_from_cache_into_store!(ssi::SymbolServerInstance, uuid::UU
end
end
else
@warn "$(pe_name) not stored on disc"
@warn "$(pe_name) not stored on disk"
store[Symbol(pe_name)] = ModuleStore(VarRef(nothing, Symbol(pe_name)), Dict{Symbol,Any}(), "$pe_name failed to load.", true, Symbol[], Symbol[])
end
end

function clear_disc_store(ssi::SymbolServerInstance)
function clear_disk_store(ssi::SymbolServerInstance)
for f in readdir(ssi.store_path)
if occursin(f, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
rm(joinpath(ssi.store_path, f), recursive = true)
Expand Down
5 changes: 2 additions & 3 deletions src/symbols.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function cache_methods(@nospecialize(f), name, env, get_return_type)
# Get inferred method return type
if get_return_type
sparams = Core.svec(sparam_syms(m[3])...)
rt = try
rt = try
@static if isdefined(Core.Compiler, :NativeInterpreter)
Core.Compiler.typeinf_type(Core.Compiler.NativeInterpreter(), m[3], m[3].sig, sparams)
else
Expand Down Expand Up @@ -472,8 +472,7 @@ function load_core(; get_return_type = false)
symbols(cache, get_return_type = get_return_type)
cache[:Main] = ModuleStore(VarRef(nothing, :Main), Dict(), "", true, [], [])

# This is wrong. As per the docs the Base.include each module should have it's own
# version.
# This is wrong. As per the docs the Base.include each module should have its own version.
push!(cache[:Base].exportednames, :include)

# Add special cases for built-ins
Expand Down
8 changes: 4 additions & 4 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -531,11 +531,11 @@ function get_file_from_cloud(manifest, uuid, environment_path, depot_dir, cache_
end

"""
validate_disc_store(store_path, manifest)
validate_disk_store(store_path, manifest)

This returns a list of non-jll packages in the manifest that don't have caches on disc.
This returns a list of non-jll packages in the manifest that don't have caches on disk.
"""
function validate_disc_store(store_path, manifest)
function validate_disk_store(store_path, manifest)
filter(manifest) do pkg
uuid = packageuuid(pkg)
endswith(packagename(manifest, uuid), "_jll") && return false
Expand Down Expand Up @@ -637,7 +637,7 @@ end

function write_cache(uuid, pkg::Package, outpath)
mkpath(dirname(outpath))
@info "Now writing to disc $uuid"
@info "Now writing to disk $uuid"
open(outpath, "w") do io
CacheStore.write(io, pkg)
end
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ end
@test haskey(store2, :Markdown)
@test haskey(store2, :TableTraits)

SymbolServer.clear_disc_store(ssi)
SymbolServer.clear_disk_store(ssi)

@test length(readdir(store_path)) == 0
end
Expand Down