mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-02-04 02:45:53 +00:00
modules/languages: finish making lib calls explicit
This commit is contained in:
parent
f2c90a861d
commit
dfc7c6737f
16 changed files with 301 additions and 217 deletions
|
|
@ -1,11 +1,16 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
||||
cfg = config.vim.languages.svelte;
|
||||
|
||||
|
|
@ -19,7 +24,7 @@
|
|||
on_attach = attach_keymaps,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/svelteserver", "--stdio"}''
|
||||
}
|
||||
}
|
||||
|
|
@ -65,7 +70,7 @@ in {
|
|||
treesitter = {
|
||||
enable = mkEnableOption "Svelte treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
|
||||
sveltePackage = nvim.types.mkGrammarOption pkgs "svelte";
|
||||
sveltePackage = mkGrammarOption pkgs "svelte";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
|
|
@ -73,14 +78,14 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "Svelte LSP server to use";
|
||||
type = with types; enum (attrNames servers);
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Svelte LSP server package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
|
||||
type = with types; either package (listOf str);
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
|
|
@ -90,13 +95,13 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "Svelte formatter to use";
|
||||
type = with types; enum (attrNames formats);
|
||||
type = enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Svelte formatter package";
|
||||
type = types.package;
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue