devos/users/modules/neovim/js.nix
2022-08-17 22:02:19 +02:00

41 lines
1 KiB
Nix

{ lib, pkgs, config, ... }:
let
typescript-lsp = pkgs.nodePackages.typescript-language-server;
tsserver-path = "${pkgs.nodePackages.typescript}/lib/node_modules/typescript/lib";
cfg = config.mae.nvim;
in
with lib;
{
options.mae.nvim.js = {
tsserver.enable = mkEnableOption "Enable js/ts support in nvim with tsserver";
deno.enable = mkEnableOption "Enable deno support in nvim";
};
config = mkMerge [
(mkIf cfg.js.deno.enable
{
mae.nvim.lsp.servers.denols = {
enable = true;
script = ''
{
cmd = { "${pkgs.deno}/bin/deno", "lsp" },
single_file_support = false,
}
'';
};
}
)
(mkIf
cfg.js.tsserver.enable
{
mae.nvim.lsp.servers.tsserver = {
enable = true;
script = ''
{
cmd = { "${typescript-lsp}/bin/typescript-language-server", "--stdio", "--tsserver-path", "${tsserver-path}" }
}
'';
};
})
];
}