mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-04-29 04:45:20 +00:00
languages/html: refactor lsp.servers to use lsp/presets/<name>
This commit is contained in:
parent
d6035ff6bc
commit
baedca4807
1 changed files with 10 additions and 20 deletions
|
|
@ -8,7 +8,8 @@
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.options) literalExpression mkEnableOption mkOption;
|
inherit (lib.options) literalExpression mkEnableOption mkOption;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.types) bool enum;
|
inherit (lib.types) bool enum listOf;
|
||||||
|
inherit (lib) genAttrs;
|
||||||
inherit (lib.lists) optional;
|
inherit (lib.lists) optional;
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics deprecatedSingleOrListOf;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics deprecatedSingleOrListOf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
|
@ -17,18 +18,7 @@
|
||||||
cfg = config.vim.languages.html;
|
cfg = config.vim.languages.html;
|
||||||
|
|
||||||
defaultServers = ["superhtml"];
|
defaultServers = ["superhtml"];
|
||||||
servers = {
|
servers = ["superhtml" "emmet-ls"];
|
||||||
superhtml = {
|
|
||||||
cmd = [(getExe pkgs.superhtml) "lsp"];
|
|
||||||
filetypes = ["html" "shtml" "htm"];
|
|
||||||
root_markers = ["index.html" ".git"];
|
|
||||||
};
|
|
||||||
emmet-ls = {
|
|
||||||
cmd = [(getExe pkgs.emmet-ls) "--stdio"];
|
|
||||||
filetypes = ["html" "shtml" "htm"];
|
|
||||||
root_markers = ["index.html" ".git"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
defaultFormat = ["superhtml"];
|
defaultFormat = ["superhtml"];
|
||||||
formats = {
|
formats = {
|
||||||
|
|
@ -70,7 +60,7 @@ in {
|
||||||
defaultText = literalExpression "config.vim.lsp.enable";
|
defaultText = literalExpression "config.vim.lsp.enable";
|
||||||
};
|
};
|
||||||
servers = mkOption {
|
servers = mkOption {
|
||||||
type = deprecatedSingleOrListOf "vim.language.html.lsp.servers" (enum (attrNames servers));
|
type = listOf (enum servers);
|
||||||
default = defaultServers;
|
default = defaultServers;
|
||||||
description = "HTML LSP server to use";
|
description = "HTML LSP server to use";
|
||||||
};
|
};
|
||||||
|
|
@ -124,12 +114,12 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.lsp.enable {
|
(mkIf cfg.lsp.enable {
|
||||||
vim.lsp.servers =
|
vim.lsp = {
|
||||||
mapListToAttrs (n: {
|
presets = genAttrs cfg.lsp.servers (_: {enable = true;});
|
||||||
name = n;
|
servers = genAttrs cfg.lsp.servers (_: {
|
||||||
value = servers.${n};
|
filetypes = ["html" "shtml" "xhtml" "htm"];
|
||||||
})
|
});
|
||||||
cfg.lsp.servers;
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf (cfg.format.enable && !cfg.lsp.enable) {
|
(mkIf (cfg.format.enable && !cfg.lsp.enable) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue