Instant startup with PackageCompiler
LanguageServer is somewhat slow to start so it is very useful to use a custom sysimage using PackageCompiler to reduce this time. On my machine I get the first response after 20+ seconds, but with a custom sysimage I can execute LS commands instantaneously.
Here is my setup:
-
Modify
init.vim
to use a custom Julia executable (if it exist):lua << EOF require'lspconfig'.julials.setup{ on_new_config = function(new_config, _) local julia = vim.fn.expand("~/.julia/environments/nvim-lspconfig/bin/julia") if require'lspconfig'.util.path.is_file(julia) then new_config.cmd[1] = julia end end } EOF
-
Utilize this Makefile.
-
Run
make
. This will set up a dummy project and launchnvim
with julia recording everything that is compiled. Wait until the LanguageServer responds (there are a bunch of things in this dummy project that will result in warnings) and then run some LanguageServer commands, for example::lua vim.lsp.buf.hover()
to fetch documentation). -
Quit nvim.
-
PackageCompiler will now build a custom
languageserver.so
sysimage. -
Profit.