mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2025-01-07 07:49:49 +01:00
Compare commits
2 commits
6584fe0995
...
9d8146e792
Author | SHA1 | Date | |
---|---|---|---|
|
9d8146e792 | ||
|
f311be9a2d |
1 changed files with 12 additions and 11 deletions
|
@ -4,28 +4,27 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.vim.languages.haskell;
|
||||
inherit (builtins) isList;
|
||||
inherit (lib) options modules nvim strings types meta;
|
||||
inherit (lib) options modules nvim strings types;
|
||||
inherit (types) either package listOf str;
|
||||
inherit (options) mkEnableOption mkOption;
|
||||
inherit (strings) optionalString;
|
||||
inherit (meta) getExe;
|
||||
inherit (modules) mkIf mkMerge;
|
||||
inherit (nvim) mkGrammarOption;
|
||||
inherit (nvim.types) mkGrammarOption;
|
||||
inherit (nvim.dag) entryAnywhere;
|
||||
inherit (nvim.lua) expToLua;
|
||||
inherit (pkgs) haskellPackages;
|
||||
cfg = config.vim.languages.haskell;
|
||||
in {
|
||||
options.vim.languages.haskell = {
|
||||
enable = mkEnableOption "Haskell support";
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Treesitter support for Haskell";
|
||||
enable = mkEnableOption "Treesitter support for Haskell" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "haskell";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "LSP support for Haskell";
|
||||
enable = mkEnableOption "LSP support for Haskell" // {default = config.vim.languages.enableLSP;};
|
||||
package = mkOption {
|
||||
description = "Haskell LSP package or command to run the Haskell LSP";
|
||||
default = haskellPackages.haskell-language-server;
|
||||
|
@ -34,7 +33,7 @@ in {
|
|||
};
|
||||
|
||||
dap = {
|
||||
enable = mkEnableOption "DAP support for Haskell";
|
||||
enable = mkEnableOption "DAP support for Haskell" // {default = config.vim.languages.enableDAP;};
|
||||
package = mkOption {
|
||||
description = "Haskell DAP package or command to run the Haskell DAP";
|
||||
default = haskellPackages.haskell-debug-adapter;
|
||||
|
@ -44,8 +43,10 @@ in {
|
|||
};
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
vim.treesitter = {
|
||||
enable = true;
|
||||
grammars = [cfg.treesitter.package];
|
||||
};
|
||||
})
|
||||
(mkIf (cfg.dap.enable || cfg.lsp.enable) {
|
||||
vim = {
|
||||
|
@ -65,7 +66,7 @@ in {
|
|||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${getExe cfg.lsp.package}"}''
|
||||
else ''{"${cfg.lsp.package}/bin/haskell-language-server-wrapper"}''
|
||||
},
|
||||
on_attach = function(client, bufnr, ht)
|
||||
default_on_attach(client, bufnr, ht)
|
||||
|
@ -86,7 +87,7 @@ in {
|
|||
cmd = ${
|
||||
if isList cfg.dap.package
|
||||
then expToLua cfg.dap.package
|
||||
else ''${getExe cfg.dap.package}''
|
||||
else ''${cfg.dap.package}/bin/haskell-debug-adapter''
|
||||
},
|
||||
},
|
||||
''}
|
||||
|
|
Loading…
Reference in a new issue