Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions modules/plugins/languages/julia.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
:::
'';
};
Expand Down
11 changes: 10 additions & 1 deletion modules/plugins/lsp/presets/julia-languageserver.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,25 @@
}: let
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 ''${pkgs.julia.withPackages ["LanguageServer"]}/bin/julia'';
in {
options.vim.lsp.presets.julia-languageserver = {
enable = mkLspPresetEnableOption {
option = "julia-languageserver";
display = "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 {
Expand All @@ -25,7 +34,7 @@ in {
root_markers = ["Project.toml" "JuliaProject.toml"];
cmd = mkLuaInline ''
{
'${pkgs.julia.withPackages ["LanguageServer"]}/bin/julia',
'${julials_bin}',
'--startup-file=no',
'--history-file=no',
'-e',
Expand Down
Loading