{ 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}" } } ''; }; }) ]; }