mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-09 03:41:35 +00:00
modules/lsp: switch to explicit lib calls
This commit is contained in:
parent
dfc7c6737f
commit
c488f0490f
33 changed files with 285 additions and 273 deletions
|
@ -1,32 +1,35 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkMerge nvim optionalString mapAttrs;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.attrsets) mapAttrs;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
in {
|
||||
config = mkIf cfg.lspconfig.enable (mkMerge [
|
||||
{
|
||||
vim.lsp.enable = true;
|
||||
vim = {
|
||||
lsp.enable = true;
|
||||
|
||||
vim.startPlugins = ["nvim-lspconfig"];
|
||||
startPlugins = ["nvim-lspconfig"];
|
||||
|
||||
vim.luaConfigRC.lspconfig = nvim.dag.entryAfter ["lsp-setup"] ''
|
||||
local lspconfig = require('lspconfig')
|
||||
luaConfigRC.lspconfig = entryAfter ["lsp-setup"] ''
|
||||
local lspconfig = require('lspconfig')
|
||||
|
||||
${
|
||||
# TODO: make border style configurable
|
||||
optionalString (config.vim.ui.borders.enable) ''
|
||||
require('lspconfig.ui.windows').default_options.border = '${config.vim.ui.borders.globalStyle}'
|
||||
''
|
||||
}
|
||||
'';
|
||||
${
|
||||
optionalString config.vim.ui.borders.enable ''
|
||||
require('lspconfig.ui.windows').default_options.border = '${config.vim.ui.borders.globalStyle}'
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
{
|
||||
vim.luaConfigRC = mapAttrs (_: v: (nvim.dag.entryAfter ["lspconfig"] v)) cfg.lspconfig.sources;
|
||||
vim.luaConfigRC = mapAttrs (_: v: (entryAfter ["lspconfig"] v)) cfg.lspconfig.sources;
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
_: {
|
||||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./lspconfig.nix
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) attrsOf str;
|
||||
in {
|
||||
options.vim.lsp.lspconfig = {
|
||||
enable = mkEnableOption "nvim-lspconfig, also enabled automatically";
|
||||
|
||||
sources = mkOption {
|
||||
description = "nvim-lspconfig sources";
|
||||
type = with types; attrsOf str;
|
||||
type = attrsOf str;
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue