mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-09 22:55:58 +01:00
Compare commits
No commits in common. "ea5f229efd65ba565728a98e6e994a917fb3fd73" and "a85bf963e6c3725d813667c8233d0a4ee3dcd9ee" have entirely different histories.
ea5f229efd
...
a85bf963e6
1 changed files with 8 additions and 26 deletions
|
@ -5,7 +5,6 @@
|
|||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames concatLists;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) bool enum either package listOf str;
|
||||
|
@ -39,7 +38,7 @@
|
|||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.deno_fmt.with({
|
||||
filetypes = ${expToLua (concatLists [cfg.format.extraFiletypes ["markdown"]])},
|
||||
filetypes = ${concatLists cfg.format.extraFiletypes ["markdown"]},
|
||||
command = "${cfg.format.package}/bin/deno",
|
||||
})
|
||||
)
|
||||
|
@ -52,9 +51,9 @@ in {
|
|||
|
||||
treesitter = {
|
||||
enable = mkOption {
|
||||
description = "Enable Markdown treesitter";
|
||||
type = bool;
|
||||
default = config.vim.languages.enableTreesitter;
|
||||
description = "Enable Markdown treesitter";
|
||||
};
|
||||
mdPackage = mkGrammarOption pkgs "markdown";
|
||||
mdInlinePackage = mkGrammarOption pkgs "markdown-inline";
|
||||
|
@ -64,16 +63,16 @@ in {
|
|||
enable = mkEnableOption "Enable Markdown LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Markdown LSP server to use";
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
description = "Markdown LSP server to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Markdown 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 = 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";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -81,39 +80,22 @@ in {
|
|||
enable = mkEnableOption "Markdown formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
description = "Markdown formatter to use";
|
||||
type = enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
description = "Markdown formatter to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Markdown formatter package";
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "Markdown formatter package";
|
||||
};
|
||||
|
||||
extraFiletypes = mkOption {
|
||||
description = "Extra filetypes to format with the Markdown formatter";
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Extra filetypes to format with the Markdown formatter";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.mdPackage cfg.treesitter.mdInlinePackage];
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.markdown-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.markdown-format = formats.${cfg.format.type}.nullConfig;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue