From 88961e0879f6bee79411337565ee998bc1f4660e Mon Sep 17 00:00:00 2001 From: qwjyh Date: Fri, 6 Oct 2023 19:36:59 +0900 Subject: [PATCH] fix: nvim: julials add generation of precompile head & add readme --- bin/neovim/add_dependencies.jl | 16 +++++++++++++++- bin/neovim/readme.md | 27 +++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 bin/neovim/readme.md diff --git a/bin/neovim/add_dependencies.jl b/bin/neovim/add_dependencies.jl index 14b9fd4..8bca6ba 100644 --- a/bin/neovim/add_dependencies.jl +++ b/bin/neovim/add_dependencies.jl @@ -1,6 +1,7 @@ # Add dependencies to Language Server project # TODO: automatically list up necessary packages using Pkg +@info "project path" Pkg.project().path # add LanguageServer.jl Pkg.add("LanguageServer") @@ -11,5 +12,18 @@ pkg_ls_deps = Pkg.dependencies()[pkg_ls].dependencies |> keys foreach(Pkg.add, pkg_ls_deps) # add extra dependencies -foreach(Pkg.add, ["Logging", "Sockets", "DataStructures"]) # these packages are manually collected +# these packages are manually collected +pkg_extra = ["Logging", "Sockets", "DataStructures", "Tar", "ArgTools"] +foreach(Pkg.add, pkg_extra) +@info "dependency added" + +# save pkgs to be used for precompile functions with traced script +out_path = joinpath(Pkg.project().path |> dirname, "precompile_exec_head.jl") +@info "writing $(out_path)" +open(out_path, "w") do io + println(io, "using LanguageServer") + println(io, "using " * join(pkg_ls_deps, ", ")) + println(io, "using " * join(pkg_extra, ", ")) +end +@info "finished writing precompile head file" diff --git a/bin/neovim/readme.md b/bin/neovim/readme.md new file mode 100644 index 0000000..b94f686 --- /dev/null +++ b/bin/neovim/readme.md @@ -0,0 +1,27 @@ +# How to manage Julia Language Server +This config use sysimage built with PackageCompiler to make language server startup faster. +Scripts in this directory is for management of sysimage. + +# description +all related process is done in project at `~/.julia/environments/nvim-lspconfig/`. + +## startup +```sh +$ ./setup_julials.sh +``` +which executes `add_dependencies.jl` internally. + +## update +```sh +$ ./update_julials.sh +``` +which updates project, compile sysimage, then do precompile. + +# effect +Start up got about x3 - x4 faster. +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 +