mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-05-21 06:16:33 +00:00
languages/haskell.nix: fix invalid keys in the haskell-tools configuration
These keys presented the error `unrecognized configs in
vim.g.haskell_tools: { "hls.filetypes", "hls.root_dir",
"tools.hover.enable", "hls.enable" }` on attaching to any haskell file.
This commit is contained in:
parent
e86a92e4b2
commit
171a5bf656
2 changed files with 65 additions and 29 deletions
|
|
@ -201,6 +201,13 @@
|
||||||
- Updated nix language plugin to use pkgs.nixfmt instead of
|
- Updated nix language plugin to use pkgs.nixfmt instead of
|
||||||
pkgs.nixfmt-rfc-style
|
pkgs.nixfmt-rfc-style
|
||||||
|
|
||||||
|
[dathegreat](https://github.com/dathegreat):
|
||||||
|
|
||||||
|
- Fixed invalid keys in the haskell-tools configuration
|
||||||
|
- Changed the default haskell formatter to
|
||||||
|
[fourmolu](https://github.com/fourmolu/fourmolu), matching the
|
||||||
|
[haskell-tools default](https://github.com/mrcjkb/haskell-tools.nvim/blob/9ea030aa67f3875753e70e1eb59701f7020479a0/lua/haskell-tools/config/internal.lua#L131)
|
||||||
|
|
||||||
[alfarel](https://github.com/alfarelcynthesis):
|
[alfarel](https://github.com/alfarelcynthesis):
|
||||||
|
|
||||||
[obsidian.nvim]: https://github.com/obsidian-nvim/obsidian.nvim
|
[obsidian.nvim]: https://github.com/obsidian-nvim/obsidian.nvim
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,19 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) isList attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.types) either package enum listOf str;
|
inherit
|
||||||
|
(lib.types)
|
||||||
|
either
|
||||||
|
package
|
||||||
|
enum
|
||||||
|
listOf
|
||||||
|
str
|
||||||
|
;
|
||||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
inherit (lib.strings) optionalString;
|
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
|
||||||
inherit (lib.meta) getExe';
|
inherit (lib.meta) getExe';
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (pkgs) haskellPackages;
|
inherit (pkgs) haskellPackages;
|
||||||
|
|
@ -22,8 +27,14 @@
|
||||||
servers = {
|
servers = {
|
||||||
hls = {
|
hls = {
|
||||||
enable = false;
|
enable = false;
|
||||||
cmd = [(getExe' pkgs.haskellPackages.haskell-language-server "haskell-language-server-wrapper") "--lsp"];
|
cmd = [
|
||||||
filetypes = ["haskell" "lhaskell"];
|
(getExe' pkgs.haskellPackages.haskell-language-server "haskell-language-server-wrapper")
|
||||||
|
"--lsp"
|
||||||
|
];
|
||||||
|
filetypes = [
|
||||||
|
"haskell"
|
||||||
|
"lhaskell"
|
||||||
|
];
|
||||||
on_attach =
|
on_attach =
|
||||||
mkLuaInline
|
mkLuaInline
|
||||||
/*
|
/*
|
||||||
|
|
@ -116,31 +127,49 @@ in {
|
||||||
(mkIf (cfg.dap.enable || cfg.lsp.enable) {
|
(mkIf (cfg.dap.enable || cfg.lsp.enable) {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["haskell-tools-nvim"];
|
startPlugins = ["haskell-tools-nvim"];
|
||||||
luaConfigRC.haskell-tools-nvim =
|
luaConfigRC.haskell-tools-nvim = entryAfter ["lsp-servers"] ''
|
||||||
entryAfter
|
vim.g.haskell_tools = {
|
||||||
["lsp-servers"]
|
tools = {
|
||||||
''
|
hover = {
|
||||||
vim.g.haskell_tools = {
|
stylize_markdown = false,
|
||||||
${optionalString cfg.lsp.enable ''
|
auto_focus = false,
|
||||||
-- LSP
|
},
|
||||||
tools = {
|
},
|
||||||
hover = {
|
hls = {
|
||||||
enable = true,
|
auto_attach = true,
|
||||||
|
cmd = {"${getExe' haskellPackages.haskell-language-server "haskell-language-server-wrapper"}", "--lsp"},
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
local ht = require("haskell-tools")
|
||||||
|
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
|
vim.keymap.set('n', '<localleader>cl', vim.lsp.codelens.run, opts)
|
||||||
|
vim.keymap.set('n', '<localleader>hs', ht.hoogle.hoogle_signature, opts)
|
||||||
|
vim.keymap.set('n', '<localleader>ea', ht.lsp.buf_eval_all, opts)
|
||||||
|
vim.keymap.set('n', '<localleader>rr', function()
|
||||||
|
vim.cmd('Haskell repl toggle')
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set('n', '<localleader>rf', function()
|
||||||
|
vim.cmd('Haskell repl toggle ' .. vim.api.nvim_buf_get_name(0))
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set('n', '<localleader>rq', function()
|
||||||
|
vim.cmd('Haskell repl quit')
|
||||||
|
end, opts)
|
||||||
|
end,
|
||||||
|
settings = function(project_root)
|
||||||
|
local ht = require("haskell-tools")
|
||||||
|
return ht.lsp.load_hls_settings(project_root)
|
||||||
|
end,
|
||||||
|
default_settings = {
|
||||||
|
haskell = {
|
||||||
|
formattingProvider = "fourmolu",
|
||||||
|
cabalFormattingProvider = "cabal-fmt",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
hls = ${toLuaObject servers.hls},
|
},
|
||||||
''}
|
dap = {
|
||||||
${optionalString cfg.dap.enable ''
|
cmd = {"${getExe' haskellPackages.haskell-debug-adapter "haskell-debug-adapter"}"},
|
||||||
dap = {
|
},
|
||||||
cmd = ${
|
}
|
||||||
if isList cfg.dap.package
|
'';
|
||||||
then toLuaObject cfg.dap.package
|
|
||||||
else ''{"${cfg.dap.package}/bin/haskell-debug-adapter"}''
|
|
||||||
},
|
|
||||||
},
|
|
||||||
''}
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue