2022-08-17 01:26:57 +02:00
|
|
|
{ lib, pkgs, config, ... }:
|
|
|
|
let
|
2022-08-17 22:02:19 +02:00
|
|
|
typescript-lsp = pkgs.nodePackages.typescript-language-server;
|
|
|
|
tsserver-path = "${pkgs.nodePackages.typescript}/lib/node_modules/typescript/lib";
|
2022-08-17 01:26:57 +02:00
|
|
|
cfg = config.mae.nvim;
|
|
|
|
in
|
|
|
|
with lib;
|
|
|
|
{
|
|
|
|
options.mae.nvim.js = {
|
|
|
|
tsserver.enable = mkEnableOption "Enable js/ts support in nvim with tsserver";
|
2022-08-17 22:02:19 +02:00
|
|
|
deno.enable = mkEnableOption "Enable deno support in nvim";
|
2022-08-17 01:26:57 +02:00
|
|
|
};
|
|
|
|
|
2022-08-17 22:02:19 +02:00
|
|
|
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,
|
|
|
|
}
|
2022-08-17 01:26:57 +02:00
|
|
|
'';
|
2022-08-17 22:02:19 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
)
|
|
|
|
(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}" }
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
2022-08-17 01:26:57 +02:00
|
|
|
}
|