From 82382f455ad37bc4fa928fe4a6fb9379a924fa3a Mon Sep 17 00:00:00 2001 From: Jose Storopoli Date: Mon, 20 Oct 2025 03:17:31 -0500 Subject: [PATCH] feat(haskell): update `haskell-tools` version and add formatters + linters (#6230) ## Description - Updates `haskell-tools` to use the recommended version in the plugin's README - Adds `ormolu` as a formatter - Adds keybindings for `haskell-tools` that does not conflict with LazyVim's defaults. ## Related Issue(s) - https://github.com/LazyVim/LazyVim/discussions/3325#discussioncomment-9562683: adds `ormolu` formatter. - https://github.com/LazyVim/LazyVim/pull/2052#issuecomment-2881764491: @mrcjkb keeps getting bug reports because the version is still in `3` and should be updated to `6`. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --------- Co-authored-by: Folke Lemaitre Co-authored-by: Claude --- lua/lazyvim/plugins/extras/lang/haskell.lua | 92 ++++++++++++++++----- 1 file changed, 73 insertions(+), 19 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/haskell.lua b/lua/lazyvim/plugins/extras/lang/haskell.lua index 48634f2d..cf4f3db6 100644 --- a/lua/lazyvim/plugins/extras/lang/haskell.lua +++ b/lua/lazyvim/plugins/extras/lang/haskell.lua @@ -14,17 +14,40 @@ return { { "mrcjkb/haskell-tools.nvim", - version = "^3", + version = false, ft = { "haskell", "lhaskell", "cabal", "cabalproject" }, - dependencies = { - { "nvim-telescope/telescope.nvim", optional = true }, + keys = { + { + "e", + "HlsEvalAll", + ft = "haskell", + desc = "Evaluate All", + }, + { + "h", + function() + require("haskell-tools").hoogle.hoogle_signature() + end, + ft = "haskell", + desc = "Hoogle Signature", + }, + { + "r", + function() + require("haskell-tools").repl.toggle() + end, + ft = "haskell", + desc = "REPL (Package)", + }, + { + "R", + function() + require("haskell-tools").repl.toggle(vim.api.nvim_buf_get_name(0)) + end, + ft = "haskell", + desc = "REPL (Buffer)", + }, }, - config = function() - local ok, telescope = pcall(require, "telescope") - if ok then - telescope.load_extension("ht") - end - end, }, { @@ -67,17 +90,48 @@ return { }, { - "luc-tielen/telescope_hoogle", - ft = { "haskell", "lhaskell", "cabal", "cabalproject" }, - dependencies = { - { "nvim-telescope/telescope.nvim", optional = true }, + "nvim-telescope/telescope.nvim", + optional = true, + specs = { + { + "luc-tielen/telescope_hoogle", + ft = { "haskell", "lhaskell", "cabal", "cabalproject" }, + opts = function() + LazyVim.on_load("telescope.nvim", function() + require("telescope").load_extension("ht") + end) + end, + keys = { + { + "H", + "Telescope hoogle", + ft = "haskell", + desc = "Hoogle", + }, + }, + }, + }, + }, + + { + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + haskell = { "fourmolu" }, + cabal = { "cabal_fmt" }, + }, + }, + }, + + { + "mfussenegger/nvim-lint", + optional = true, + opts = { + linters_by_ft = { + haskell = { "hlint" }, + }, }, - config = function() - local ok, telescope = pcall(require, "telescope") - if ok then - telescope.load_extension("hoogle") - end - end, }, -- Make sure lspconfig doesn't start hls,