mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-06-11 15:33:18 +00:00
language/haskell: let conform handle cabal formatting
This commit is contained in:
parent
4dfed34c10
commit
802206bff4
2 changed files with 27 additions and 43 deletions
|
|
@ -4,16 +4,11 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.meta) getExe getExe';
|
||||
inherit (lib.meta) getExe';
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.types) mkLspPresetEnableOption;
|
||||
|
||||
cfg = config.vim.lsp.presets.haskell-language-server;
|
||||
cabalFmtCfg = config.vim.languages.haskell.cabalFormat;
|
||||
cabalFormats = {
|
||||
cabal-fmt = pkgs.haskellPackages.cabal-fmt;
|
||||
cabal-gild = pkgs.haskellPackages.cabal-gild;
|
||||
};
|
||||
in {
|
||||
options.vim.lsp.presets.haskell-language-server = {
|
||||
enable = mkLspPresetEnableOption "haskell-language-server" "Haskell" [];
|
||||
|
|
@ -32,14 +27,6 @@ in {
|
|||
"--lsp"
|
||||
];
|
||||
root_markers = ["hie.yaml" "stack.yaml" "cabal.project" "*.cabal" "package.yaml"];
|
||||
settings = mkIf cabalFmtCfg.enable {
|
||||
haskell = {
|
||||
cabalFormattingProvider = cabalFmtCfg.type;
|
||||
# This option is undocumented in the haskell-language-server docs, but it does exist in the plugin API
|
||||
# https://github.com/haskell/haskell-language-server/blob/f158128ec034bec1667c440262641086bbb4d359/plugins/hls-cabal-fmt-plugin/src/Ide/Plugin/CabalFmt.hs#L51
|
||||
plugin.${cabalFmtCfg.type}.config.path = getExe cabalFormats.${cabalFmtCfg.type};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue