lsp/presets/ols: init

This commit is contained in:
Snoweuph 2026-04-11 18:01:21 +02:00
commit 92a912a713
No known key found for this signature in database
GPG key ID: BEFC41DA223CEC55
2 changed files with 30 additions and 0 deletions

View file

@ -5,6 +5,7 @@
./harper.nix
./intelephense.nix
./lemminx.nix
./ols.nix
./openscad-lsp.nix
./phan.nix
./phpactor.nix

View file

@ -0,0 +1,29 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption;
inherit (lib.generators) mkLuaInline;
cfg = config.vim.lsp.presets.ols;
in {
options.vim.lsp.presets.ols = {
enable = mkEnableOption "the Odin Language Server";
};
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'';
};
};
}