Skip to content

Commit bc8051e

Browse files
authored
Merge pull request #280 from julia-vscode/sp/fix-111
fix: Julia 1.11 compat
2 parents 99eaa44 + b283552 commit bc8051e

File tree

6 files changed

+30
-14
lines changed

6 files changed

+30
-14
lines changed

.github/workflows/jlpkgbutler-ci-master-workflow.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
julia-version: ['1.0', '1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7', '1.8', '1.9']
15+
julia-version: ['1.0', '1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7', '1.8', '1.9', 'nightly']
1616
julia-arch: [x64, x86]
1717
os: [ubuntu-latest, windows-latest, macOS-latest]
1818
exclude:
@@ -37,4 +37,3 @@ jobs:
3737
files: ./lcov.info
3838
flags: unittests
3939
token: ${{ secrets.CODECOV_TOKEN }}
40-

.github/workflows/jlpkgbutler-ci-pr-workflow.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@ jobs:
99
runs-on: ${{ matrix.os }}
1010
strategy:
1111
matrix:
12-
julia-version: ['1.0', '1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7', '1.8', '1.9']
13-
julia-arch: [x64, x86]
12+
julia-version: ['1.0', '1.6', '1.9', 'nightly']
13+
julia-arch: [x64]
1414
os: [ubuntu-latest, windows-latest, macOS-latest]
15-
exclude:
16-
- os: macOS-latest
17-
julia-arch: x86
1815

1916
steps:
2017
- uses: actions/checkout@v3

src/SymbolServer.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,15 @@ function getstore(ssi::SymbolServerInstance, environment_path::AbstractString, p
221221
end
222222
end
223223
take!(server_is_ready)
224-
p = open(pipeline(Cmd(`$jl_cmd --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_for_client_process), read=true, write=true)
224+
225+
# 1.11 introduces the --compiled-modules=existing option, which should be much faster than no
226+
# as of 2023-11-09, loading Pkg with --compiled-modules=no also changes something with the
227+
# active project, which breaks the server.jl script
228+
p = if VERSION > v"1.11-"
229+
open(pipeline(Cmd(`$jl_cmd --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)
230+
else
231+
open(pipeline(Cmd(`$jl_cmd --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)
232+
end
225233
ssi.process = p
226234

227235
yield()

src/server.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ write_depot(server, server.context, written_caches)
125125

126126
@info "Symbol server indexing took $((time_ns() - start_time) / 1e9) seconds."
127127

128-
println(conn, "DONE")
129-
close(conn)
128+
if conn !== nothing
129+
println(conn, "DONE")
130+
close(conn)
131+
end
130132

131133
end

test/runtests.jl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ function check_varrefs(env, m=nothing)
4646
for x in values(m.vals)
4747
if x isa SymbolServer.VarRef && x.parent !== nothing
4848
x0 = SymbolServer._lookup(x.parent, env, true)
49+
50+
if x0 === nothing && x.parent !== nothing && x.parent.name === :Pidfile
51+
# these are dynamically put into Base when loading FileWatching, so we
52+
# don't need to error out when not finding them from the root env
53+
continue
54+
end
55+
4956
@test x0 !== nothing
5057
@test x0 !== m
5158
elseif x isa SymbolServer.ModuleStore
@@ -90,14 +97,15 @@ end
9097
end
9198

9299
mktempdir() do path
93-
cp(joinpath(@__DIR__, "testenv", "Project.toml"), joinpath(path, "Project.toml"))
94-
cp(joinpath(@__DIR__, "testenv", "Manifest.toml"), joinpath(path, "Manifest.toml"))
100+
cp(joinpath(@__DIR__, "testenv"), path; force=true)
95101

96102
store_path = joinpath(path, "store")
97103
mkpath(store_path)
98104

99105
jl_cmd = joinpath(Sys.BINDIR, Base.julia_exename())
100-
run(`$jl_cmd --project=$path --startup-file=no -e 'using Pkg; Pkg.instantiate()'`)
106+
withenv("JULIA_PKG_PRECOMPILE_AUTO" => 0) do
107+
run(`$jl_cmd --project=$path --startup-file=no -e 'using Pkg; Pkg.instantiate()'`)
108+
end
101109

102110
ssi = SymbolServerInstance("", store_path)
103111

@@ -108,9 +116,10 @@ end
108116
end
109117

110118
# We sleep for a second here to make sure the async task we started
111-
# previously gets run first
119+
# previously gets started first
112120
sleep(1)
113121

122+
# this will cancel the previous getstore request
114123
ret_status2, store2 = getstore(ssi, path, download = false)
115124

116125
if ret_status2 == :failure

test/testenv/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[deps]
2+
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
23
IteratorInterfaceExtensions = "82899510-4779-5014-852e-03e436cf321d"
34
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
45
TableTraits = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c"

0 commit comments

Comments
 (0)