From cdbb2bdeb07e140f7dd9cc197a74d300451cb2f5 Mon Sep 17 00:00:00 2001 From: Soliprem Date: Tue, 16 Jun 2026 14:28:50 +0200 Subject: [PATCH] lsp/presets: add option to use PATH julia instead of bundling also changes docs under languages/julia --- modules/plugins/languages/julia.nix | 13 ++++++++----- .../plugins/lsp/presets/julia-languageserver.nix | 11 ++++++++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/modules/plugins/languages/julia.nix b/modules/plugins/languages/julia.nix index 51737d2f..381ee759 100644 --- a/modules/plugins/languages/julia.nix +++ b/modules/plugins/languages/julia.nix @@ -51,12 +51,15 @@ in { The entirety of Julia is bundled with nvf, if you enable this option, since there is no way to provide only the LSP server. - If you want to avoid that, you have to change - {option}`vim.lsp.servers.julials.cmd` to use - the Julia binary in {env}`PATH`, and add the `LanguageServer` - package to Julia in your devshells. + Since the LSP server is a julia package that needs to be bundled + within a Julia binary, there is no way for us to provide only the + LSP server. By default, you'll just have to add the `LanguageServer` + package to Julia in your devshells (or general environment), and be + good to go. - Check the source file of this option for the full `cmd`. + If you want to have the entirety of Julia bundled within nvf, you can + change {option}`vim.lsp.servers.presets.julia-languageserver.usePathBin` + to `false` to have nvf bundle julia and the lsp. ::: ''; }; diff --git a/modules/plugins/lsp/presets/julia-languageserver.nix b/modules/plugins/lsp/presets/julia-languageserver.nix index 61b5d290..7d19d9ab 100644 --- a/modules/plugins/lsp/presets/julia-languageserver.nix +++ b/modules/plugins/lsp/presets/julia-languageserver.nix @@ -7,13 +7,22 @@ inherit (lib.meta) getExe; inherit (lib.modules) mkIf; inherit (lib.nvim.types) mkLspPresetEnableOption; + inherit (lib.nvim.config) mkBool; inherit (lib.generators) mkLuaInline; inherit (lib.nvim.dag) entryBefore; cfg = config.vim.lsp.presets.julia-languageserver; + julials_bin = + if cfg.usePathBin + then "julia" + else getExe (pkgs.julia-bin.withPackages ["LanguageServer"]); in { options.vim.lsp.presets.julia-languageserver = { enable = mkLspPresetEnableOption "julia-languageserver" "Julia" []; + usePathBin = mkBool true '' + use julia taken from PATH, instead of bundling it within nvf. + You'll need to add "LanguageServer" to your Julia instance for this to work + ''; }; config = mkIf cfg.enable { @@ -23,7 +32,7 @@ in { root_markers = ["Project.toml" "JuliaProject.toml"]; cmd = mkLuaInline '' { - '${getExe (pkgs.julia.withPackages ["LanguageServer"])}', + '${julials_bin}', '--startup-file=no', '--history-file=no', '-e',