mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-04-27 11:55:22 +00:00
lsp/presets/nimlsp: init
This commit is contained in:
parent
11eddae2eb
commit
a8e4dc1817
2 changed files with 33 additions and 0 deletions
|
|
@ -6,6 +6,7 @@
|
||||||
./intelephense.nix
|
./intelephense.nix
|
||||||
./lemminx.nix
|
./lemminx.nix
|
||||||
./nil.nix
|
./nil.nix
|
||||||
|
./nimlsp.nix
|
||||||
./nixd.nix
|
./nixd.nix
|
||||||
./nushell.nix
|
./nushell.nix
|
||||||
./ocaml-lsp.nix
|
./ocaml-lsp.nix
|
||||||
|
|
|
||||||
32
modules/plugins/lsp/presets/nimlsp.nix
Normal file
32
modules/plugins/lsp/presets/nimlsp.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
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.nimlsp;
|
||||||
|
in {
|
||||||
|
options.vim.lsp.presets.nimlsp = {
|
||||||
|
enable = mkEnableOption "the Nim Language Server";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim.lsp.servers.nimlsp = {
|
||||||
|
enable = true;
|
||||||
|
cmd = [(getExe pkgs.nimlsp)];
|
||||||
|
root_dir = mkLuaInline ''
|
||||||
|
function(bufnr, on_dir)
|
||||||
|
local fname = vim.api.nvim_buf_get_name(bufnr)
|
||||||
|
on_dir(
|
||||||
|
util.root_pattern '*.nimble'(fname) or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1])
|
||||||
|
)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue