mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 02:11:33 +00:00
feat: refactor and separate LSP/language configurations
This commit is contained in:
parent
7a71f06763
commit
6b512f132a
30 changed files with 1266 additions and 522 deletions
25
modules/lsp/lspconfig/config.nix
Normal file
25
modules/lsp/lspconfig/config.nix
Normal 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;
|
||||
}
|
||||
]);
|
||||
}
|
6
modules/lsp/lspconfig/default.nix
Normal file
6
modules/lsp/lspconfig/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./config.nix
|
||||
./lspconfig.nix
|
||||
];
|
||||
}
|
18
modules/lsp/lspconfig/lspconfig.nix
Normal file
18
modules/lsp/lspconfig/lspconfig.nix
Normal 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 = {};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue