mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-22 19:38:00 +00:00
lib/languages: add lspOptions
submodule type for freeform LSP config
This commit is contained in:
parent
0644475408
commit
208f02f3e8
1 changed files with 32 additions and 3 deletions
|
@ -1,9 +1,11 @@
|
|||
# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/booleans.nix
|
||||
{lib}: let
|
||||
inherit (builtins) isString getAttr;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) bool;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) listOf bool str submodule attrsOf anything;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.types) luaInline;
|
||||
in {
|
||||
diagnosticsToLua = {
|
||||
lang,
|
||||
|
@ -32,4 +34,31 @@ in {
|
|||
type = bool;
|
||||
description = "Turn on ${desc} for enabled languages by default";
|
||||
};
|
||||
|
||||
lspOptions = submodule {
|
||||
freeformType = attrsOf anything;
|
||||
options = {
|
||||
capabilities = mkOption {
|
||||
type = luaInline;
|
||||
default = mkLuaInline "default_capabilities";
|
||||
description = "LSP capabilitiess to pass to lspconfig";
|
||||
};
|
||||
|
||||
on_attach = mkOption {
|
||||
type = luaInline;
|
||||
default = mkLuaInline "default_capabilities";
|
||||
description = "Function to execute when an LSP server attaches to a buffer";
|
||||
};
|
||||
|
||||
filetypes = mkOption {
|
||||
type = listOf str;
|
||||
description = "Filetypes to auto-attach LSP in";
|
||||
};
|
||||
|
||||
cmd = mkOption {
|
||||
type = listOf str;
|
||||
description = "Command used to start the LSP server";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue