modules: add typescript-tools plugin

This commit is contained in:
Dmitriy Pleshevskiy 2024-08-10 14:16:38 +03:00
parent ff8a211f1c
commit dd5d3cb614
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
2 changed files with 43 additions and 0 deletions

View file

@ -17,6 +17,7 @@
./modules/plugins/interface/lualine.nix ./modules/plugins/interface/lualine.nix
./modules/plugins/language-server/lspconfig.nix ./modules/plugins/language-server/lspconfig.nix
./modules/plugins/language-server/nlsp-settings.nix ./modules/plugins/language-server/nlsp-settings.nix
./modules/plugins/language-server/typescript-tools.nix
./modules/plugins/navigation/hop-nvim.nix ./modules/plugins/navigation/hop-nvim.nix
./modules/plugins/navigation/telescope.nix ./modules/plugins/navigation/telescope.nix
./modules/plugins/navigation/nvim-tree.nix ./modules/plugins/navigation/nvim-tree.nix

View file

@ -0,0 +1,42 @@
{ config, lib, pkgs, ... }:
let
cfg = config.plugins.language-server.typescript-tools;
in
{
options.plugins.language-server.typescript-tools = with lib; {
enable = lib.mkEnableOption "typescript-tools";
package = mkPackageOption pkgs.vimPlugins "typescript-tools-nvim" { };
serverSettings = mkOption {
type = with types; attrsOf attrs;
default = { };
description = ''
Server-specific settings.
See config options here: https://github.com/pmizio/typescript-tools.nvim
`:help lspconfig-setup`
'';
};
};
config = lib.mkIf cfg.enable {
assertions = [
{
assertion = !(config.plugins.language-server.lspconfig.serverSettings ? tsserver);
message = "You should not have 'typescript-language-server' and 'typescript-tools' enabled together because they are both LSP for the same language";
}
];
plugin.plenary-nvim = { };
plugin.typescript-tools-nvim = {
enable = true;
name = "typescript-tools";
inherit (cfg) package;
setupSettings = cfg.serverSettings;
};
};
}