blob: c5315d098767b8ac1707751112e1014903c5e112 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
{
config,
lib,
pkgs,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.types) mkLspPresetEnableOption;
inherit (lib.meta) getExe;
inherit (lib.generators) mkLuaInline;
cfg = config.vim.lsp.presets.ols;
in {
options.vim.lsp.presets.ols = {
enable = mkLspPresetEnableOption {
option = "ols";
display = "Odin";
};
};
config = mkIf cfg.enable {
vim.lsp.servers.ols = {
enable = true;
cmd = [(getExe pkgs.ols)];
root_dir = mkLuaInline ''
function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
on_dir(util.root_pattern('ols.json', '.git', '*.odin')(fname))
end'';
};
};
}
|