Skip to content

Commit cbc756a

Browse files
committed
lsp/presets: add option to use PATH julia instead of bundling
also changes docs under languages/julia
1 parent 4d990ef commit cbc756a

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

modules/plugins/languages/julia.nix

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,15 @@ in {
5151
The entirety of Julia is bundled with nvf, if you enable this
5252
option, since there is no way to provide only the LSP server.
5353
54-
If you want to avoid that, you have to change
55-
{option}`vim.lsp.servers.julials.cmd` to use
56-
the Julia binary in {env}`PATH`, and add the `LanguageServer`
57-
package to Julia in your devshells.
54+
Since the LSP server is a julia package that needs to be bundled
55+
within a Julia binary, there is no way for us to provide only the
56+
LSP server. By default, you'll just have to add the `LanguageServer`
57+
package to Julia in your devshells (or general environment), and be
58+
good to go.
5859
59-
Check the source file of this option for the full `cmd`.
60+
If you want to have the entirety of Julia bundled within nvf, you can
61+
change {option}`vim.lsp.servers.presets.julia-languageserver.usePathBin`
62+
to `false` to have nvf bundle julia and the lsp.
6063
:::
6164
'';
6265
};

modules/plugins/lsp/presets/julia-languageserver.nix

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,22 @@
77
inherit (lib.meta) getExe;
88
inherit (lib.modules) mkIf;
99
inherit (lib.nvim.types) mkLspPresetEnableOption;
10+
inherit (lib.nvim.config) mkBool;
1011
inherit (lib.generators) mkLuaInline;
1112
inherit (lib.nvim.dag) entryBefore;
1213

1314
cfg = config.vim.lsp.presets.julia-languageserver;
15+
julials_bin =
16+
if cfg.usePathBin
17+
then "julia"
18+
else getExe (pkgs.julia-bin.withPackages ["LanguageServer"]);
1419
in {
1520
options.vim.lsp.presets.julia-languageserver = {
1621
enable = mkLspPresetEnableOption "julia-languageserver" "Julia" [];
22+
usePathBin = mkBool false ''
23+
use julia taken from PATH, instead of bundling it within nvf.
24+
You'll need to add "LanguageServer" to your Julia instance for this to work
25+
'';
1726
};
1827

1928
config = mkIf cfg.enable {
@@ -23,7 +32,7 @@ in {
2332
root_markers = ["Project.toml" "JuliaProject.toml"];
2433
cmd = mkLuaInline ''
2534
{
26-
'${getExe (pkgs.julia.withPackages ["LanguageServer"])}',
35+
'${julials_bin}',
2736
'--startup-file=no',
2837
'--history-file=no',
2938
'-e',

0 commit comments

Comments
 (0)