feat: refactor and separate LSP/language configurations

This commit is contained in:
NotAShelf 2023-04-17 23:27:27 +03:00
commit 6b512f132a
No known key found for this signature in database
GPG key ID: F0D14CCB5ED5AA22
30 changed files with 1266 additions and 522 deletions

View file

@ -0,0 +1,25 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.lsp;
in {
config = mkIf cfg.lspconfig.enable (mkMerge [
{
vim.lsp.enable = true;
vim.startPlugins = ["nvim-lspconfig"];
vim.luaConfigRC.lspconfig = nvim.dag.entryAfter ["lsp-setup"] ''
local lspconfig = require('lspconfig')
'';
}
{
vim.luaConfigRC = mapAttrs (_: v: (nvim.dag.entryAfter ["lspconfig"] v)) cfg.lspconfig.sources;
}
]);
}

View file

@ -0,0 +1,6 @@
_: {
imports = [
./config.nix
./lspconfig.nix
];
}

View file

@ -0,0 +1,18 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; {
options.vim.lsp.lspconfig = {
enable = mkEnableOption "nvim-lspconfig, also enabled automatically";
sources = mkOption {
description = "nvim-lspconfig sources";
type = with types; attrsOf str;
default = {};
};
};
}