]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/nvim/lua/plugins/haskell-tools.lua
+use/op(nvim): tweak config
[julm/julm-nix.git] / home-manager / profiles / nvim / lua / plugins / haskell-tools.lua
1 -- If you are starting out with Haskell, nvim-lspconfig.hls is probably enough for you.
2 -- It provides the lowest common denominator of LSP support.
3 -- This plugin is for those who would like additional features
4 -- that are specific to Haskell tooling.
5 -- https://github.com/MrcJkb/haskell-tools.nvim
6 return {
7 "haskell-tools.nvim",
8 lazy = false,
9 priority = 40,
10 after = function()
11 -- This is a filetype plugin that works out of the box,
12 -- so there is no need to call a setup function or configure anything
13 -- to get this plugin working.
14 vim.g.haskell_tools = {
15 tools = {
16 hover = {
17 enable = true,
18 },
19 },
20 --[[
21 hls = {
22 cmd = { "haskell-language-server-wrapper", "--lsp" },
23 enable = false,
24 filetypes = { "haskell", "lhaskell" },
25 on_attach = function(client, bufnr)
26 local ht = require("haskell-tools")
27 local opts = { noremap = true, silent = true, buffer = bufnr }
28 vim.keymap.set("n", "<localleader>cl", vim.lsp.codelens.run, opts)
29 vim.keymap.set("n", "<localleader>hs", ht.hoogle.hoogle_signature, opts)
30 vim.keymap.set("n", "<localleader>ea", ht.lsp.buf_eval_all, opts)
31 vim.keymap.set("n", "<localleader>rr", ht.repl.toggle, opts)
32 vim.keymap.set("n", "<localleader>rf", function()
33 ht.repl.toggle(vim.api.nvim_buf_get_name(0))
34 end, opts)
35 vim.keymap.set("n", "<localleader>rq", ht.repl.quit, opts)
36 end,
37 root_dir = function(bufnr, on_dir)
38 local fname = vim.api.nvim_buf_get_name(bufnr)
39 on_dir(
40 util.root_pattern("hie.yaml", "stack.yaml", "cabal.project", "*.cabal", "package.yaml")(fname)
41 )
42 end,
43 settings = { haskell = { cabalFormattingProvider = "cabalfmt", formattingProvider = "fourmolu" } },
44 },
45 ]]
46 }
47 require("telescope").load_extension("ht")
48 end,
49 }