refactor(julials): update docs & remove unused shell scripts

This commit is contained in:
qwjyh 2024-10-22 18:27:36 +09:00
parent ad4a9f53a1
commit f5efb7cb66
5 changed files with 23 additions and 40 deletions

View file

@ -1,27 +1,24 @@
# How to manage Julia Language Server # How to manage Julia Language Server
This config use sysimage built with PackageCompiler to make language server startup faster. This config use sysimage built with PackageCompiler to make language server starts faster.
Scripts in this directory is for management of sysimage. Scripts in this directory are for management of the sysimage.
# description # description
all related process is done in project at `~/.julia/environments/nvim-lspconfig/`. all related process is done in project at `~/.julia/environments/nvim-lspconfig/`.
## startup ## install (or minor update of Julia)
```sh ```sh
$ ./setup_julials.sh julia ./setup_julials.jl
``` ```
which executes `add_dependencies.jl` internally. Run Language Server with `--tracecompile` option from any editor.
## update ## update
```sh ```sh
$ ./update_julials.sh julia ./update_julials.sh
``` ```
which updates project, compile sysimage, then do precompile. which updates project, compile sysimage, then do precompile.
To use the sysimage, run Language Server with `-J ~/.julia/environments/nvim-lspconfig/` option.
# effect # effect
Start up got about x3 - x4 faster. Start up got about x3 - x4 faster.
It still takes some time to load packages though. It still takes some time to load packages though.
# TODO
- [ ] Not sure all necessary packages are listed in add_dependencies.jl
- [ ] Maybe it's better to set up different sysimages for each projects

View file

@ -1,15 +1,9 @@
#!/usr/bin/julia #!/usr/bin/julia
project_path = joinpath(homedir(), ".julia", "environments", "nvim-lspconfig") project_path = joinpath(homedir(), ".julia", "environments", "nvim-lspconfig")
if !ispath(project_path) if !ispath(project_path)
try
mkdir(project_path) mkdir(project_path)
@info "Created $(project_path)" @info "Created $(project_path)"
touch(joinpath(project_path, "tracecompile.jl")) touch(joinpath(project_path, "tracecompile.jl"))
catch e
@error e
@error dump(e)
throw(e)
end
end end
cmd = `julia --project=$(project_path) $(@__DIR__)/add_dependencies.jl` cmd = `julia --project=$(project_path) $(@__DIR__)/add_dependencies.jl`
@info cmd @info cmd

View file

@ -1,2 +0,0 @@
#!/usr/bin/bash -x
julia --project=~/.julia/environments/nvim-lspconfig ./add_dependencies.jl

View file

@ -1,6 +1,6 @@
#!/usr/bin/julia #!/usr/bin/julia
project_path = joinpath(homedir(), ".julia", "environments", "nvim-lspconfig") project_path = joinpath(homedir(), ".julia", "environments", "nvim-lspconfig")
cd(project_path) cd(project_path) do
@info "now at " pwd() @info "now at " pwd()
run(`julia --project=. -e 'using Pkg; Pkg.update()'`) run(`julia --project=. -e 'using Pkg; Pkg.update()'`)
compile_traces = Iterators.filter(eachline("tracecompile.jl")) do line compile_traces = Iterators.filter(eachline("tracecompile.jl")) do line
@ -12,4 +12,5 @@ read("precompile_exec_head.jl", String) * compile_traces |> (b -> write("precomp
run(`julia --project=. -e 'using PackageCompiler; create_sysimage(["LanguageServer"], sysimage_path = "sys-ls.so", precompile_execution_file = ["precompile_exec.jl"])'`) run(`julia --project=. -e 'using PackageCompiler; create_sysimage(["LanguageServer"], sysimage_path = "sys-ls.so", precompile_execution_file = ["precompile_exec.jl"])'`)
@info "post precompile" @info "post precompile"
run(`julia --project=. -J sys-ls.so -e 'using Pkg; Pkg.precompile()'`) run(`julia --project=. -J sys-ls.so -e 'using Pkg; Pkg.precompile()'`)
end

View file

@ -1,7 +0,0 @@
#!/usr/bin/bash -x
cd ~/.julia/environments/nvim-lspconfig/ || return 1
julia --project=. -e 'using Pkg; Pkg.update()'
cat precompile_exec_head.jl tracecompile.jl > precompile_exec.jl
julia --project=. -e 'using PackageCompiler; create_sysimage(["LanguageServer"], sysimage_path="sys-ls.so", precompile_execution_file=["precompile_exec.jl"])'
julia --project=. -J sys-ls.so -e 'using Pkg; Pkg.precompile()'