mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-07 19:01:35 +00:00
add markdown as well
This commit is contained in:
parent
7ae81ca51b
commit
96f3524a4d
2 changed files with 19 additions and 29 deletions
|
@ -11,7 +11,7 @@
|
||||||
inherit (lib.attrsets) mapAttrsToList attrNames filterAttrs;
|
inherit (lib.attrsets) mapAttrsToList attrNames filterAttrs;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.languages) lspOptions;
|
inherit (lib.nvim.languages) lspOptions;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp;
|
||||||
|
@ -81,7 +81,9 @@ in {
|
||||||
}
|
}
|
||||||
|
|
||||||
(mkIf (cfg.servers != {}) {
|
(mkIf (cfg.servers != {}) {
|
||||||
vim.luaConfigRC.lsp-servers = entryAnywhere ''
|
# Enable lspconfig in order to merge in the predefined opts
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.luaConfigRC.lsp-servers = entryAfter ["lspconfig"] ''
|
||||||
-- Individual LSP configurations managed by nvf.
|
-- Individual LSP configurations managed by nvf.
|
||||||
${concatLines lspConfigurations}
|
${concatLines lspConfigurations}
|
||||||
|
|
||||||
|
|
|
@ -9,27 +9,18 @@
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) bool enum either package listOf str nullOr;
|
inherit (lib.types) bool enum package listOf str nullOr;
|
||||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.nvim.types) diagnostics mkGrammarOption mkPluginSetupOption;
|
inherit (lib.nvim.types) diagnostics mkGrammarOption mkPluginSetupOption;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
|
|
||||||
cfg = config.vim.languages.markdown;
|
cfg = config.vim.languages.markdown;
|
||||||
defaultServer = "marksman";
|
defaultServers = ["marksman"];
|
||||||
servers = {
|
servers = {
|
||||||
marksman = {
|
marksman = {
|
||||||
package = pkgs.marksman;
|
enable = true;
|
||||||
lspConfig = ''
|
cmd = ["${pkgs.marksman}/bin/marksman" "server"];
|
||||||
lspconfig.marksman.setup{
|
|
||||||
capabilities = capabilities;
|
|
||||||
on_attach = default_on_attach;
|
|
||||||
cmd = ${
|
|
||||||
if isList cfg.lsp.package
|
|
||||||
then expToLua cfg.lsp.package
|
|
||||||
else ''{"${cfg.lsp.package}/bin/marksman", "server"}''
|
|
||||||
},
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -69,17 +60,10 @@ in {
|
||||||
lsp = {
|
lsp = {
|
||||||
enable = mkEnableOption "Enable Markdown LSP support" // {default = config.vim.lsp.enable;};
|
enable = mkEnableOption "Enable Markdown LSP support" // {default = config.vim.lsp.enable;};
|
||||||
|
|
||||||
server = mkOption {
|
servers = mkOption {
|
||||||
type = enum (attrNames servers);
|
|
||||||
default = defaultServer;
|
|
||||||
description = "Markdown LSP server to use";
|
description = "Markdown LSP server to use";
|
||||||
};
|
type = listOf (enum (attrNames servers));
|
||||||
|
default = defaultServers;
|
||||||
package = mkOption {
|
|
||||||
type = either package (listOf str);
|
|
||||||
default = servers.${cfg.lsp.server}.package;
|
|
||||||
example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]'';
|
|
||||||
description = "Markdown LSP server package, or the command to run as a list of strings";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -161,8 +145,12 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.lsp.enable {
|
(mkIf cfg.lsp.enable {
|
||||||
vim.lsp.lspconfig.enable = true;
|
vim.lsp.servers =
|
||||||
vim.lsp.lspconfig.sources.markdown-lsp = servers.${cfg.lsp.server}.lspConfig;
|
mapListToAttrs (n: {
|
||||||
|
name = n;
|
||||||
|
value = servers.${n};
|
||||||
|
})
|
||||||
|
cfg.lsp.servers;
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue