Skip to content

Commit b3f883d

Browse files
authored
Merge pull request #291 from julia-vscode/simplify-version
Expect version of Julia.exe as argument
2 parents 7315ee9 + f32a33a commit b3f883d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/SymbolServer.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@ mutable struct SymbolServerInstance
2020
process::Union{Nothing,Base.Process}
2121
depot_path::String
2222
julia_exe_path::String
23+
julia_exe_version::VersionNumber
2324
canceled_processes::Set{Process}
2425
store_path::String
2526
symbolcache_upstream::String
2627

27-
function SymbolServerInstance(depot_path::String="", store_path::Union{String,Nothing}=nothing, julia_exe_path::Union{String,Nothing}=nothing; symbolcache_upstream = nothing)
28+
function SymbolServerInstance(depot_path::String="", store_path::Union{String,Nothing}=nothing, julia_exe::Union{NamedTuple{(:path,:version),Tuple{String,VersionNumber}},Nothing}=nothing; symbolcache_upstream = nothing)
2829
if symbolcache_upstream === nothing
2930
symbolcache_upstream = "https://www.julia-vscode.org/symbolcache"
3031
end
31-
return new(nothing, depot_path, julia_exe_path === nothing ? joinpath(Sys.BINDIR, Base.julia_exename()) : julia_exe_path, Set{Process}(), store_path === nothing ? abspath(joinpath(@__DIR__, "..", "store")) : store_path, symbolcache_upstream)
32+
return new(nothing, depot_path, julia_exe === nothing ? joinpath(Sys.BINDIR, Base.julia_exename()) : julia_exe.path, julia_exe === nothing ? VERSION : julia_exe.version, Set{Process}(), store_path === nothing ? abspath(joinpath(@__DIR__, "..", "store")) : store_path, symbolcache_upstream)
3233
end
3334
end
3435

@@ -229,8 +230,7 @@ function getstore(ssi::SymbolServerInstance, environment_path::AbstractString, p
229230
# 1.11 introduces the --compiled-modules=existing option, which should be much faster than no
230231
# as of 2023-11-09, loading Pkg with --compiled-modules=no also changes something with the
231232
# active project, which breaks the server.jl script
232-
symbol_server_julia_version = VersionNumber(readchomp(Cmd(`$(ssi.julia_exe_path) --startup-file=no --history-file=no -e "println(VERSION)"`)))
233-
p = if symbol_server_julia_version > v"1.11-"
233+
p = if ssi.julia_exe_version > v"1.11-"
234234
open(pipeline(Cmd(`$(ssi.julia_exe_path) --code-coverage=$(use_code_coverage==0 ? "none" : "user") --startup-file=no --compiled-modules=existing --history-file=no --project=$environment_path $server_script $(ssi.store_path) $pipename`, env=env_to_use), stderr=stderr), read=true, write=true)
235235
else
236236
open(pipeline(Cmd(`$(ssi.julia_exe_path) --code-coverage=$(use_code_coverage==0 ? "none" : "user") --startup-file=no --compiled-modules=no --history-file=no --project=$environment_path $server_script $(ssi.store_path) $pipename`, env=env_to_use), stderr=stderr), read=true, write=true)

0 commit comments

Comments
 (0)