mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +00:00
Merge branch 'main' into v0.6
This commit is contained in:
commit
b397dcb430
5 changed files with 116 additions and 4 deletions
|
@ -37,6 +37,33 @@
|
|||
'';
|
||||
};
|
||||
};
|
||||
|
||||
defaultFormat = "prettier";
|
||||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.nodePackages.prettier;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
command = "${cfg.format.package}/bin/prettier",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
prettierd = {
|
||||
package = pkgs.prettierd;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
command = "${cfg.format.package}/bin/prettierd",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.css = {
|
||||
enable = mkEnableOption "CSS language support";
|
||||
|
@ -63,6 +90,22 @@ in {
|
|||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
|
||||
format = {
|
||||
enable = mkEnableOption "CSS formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
description = "CSS formatter to use";
|
||||
type = with types; enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "CSS formatter package";
|
||||
type = types.package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
|
@ -73,7 +116,12 @@ in {
|
|||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.tailwindcss-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
vim.lsp.lspconfig.sources.css-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.css-format = formats.${cfg.format.type}.nullConfig;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ in {
|
|||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.css-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
vim.lsp.lspconfig.sources.tailwindcss-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue