LazyVim.LazyVim/lua/lazyvim/plugins/extras/lang/haskell.lua

155 lines
3.3 KiB
Lua
Raw Normal View History

2024-03-07 11:51:08 +01:00
return {
recommended = function()
return LazyVim.extras.wants({
ft = { "haskell", "lhaskell" },
root = { "hie.yaml", "stack.yaml", "cabal.project", "*.cabal", "package.yaml" },
})
end,
2024-03-07 11:51:08 +01:00
-- Add Haskell to treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = { ensure_installed = { "haskell" } },
2024-03-07 11:51:08 +01:00
},
{
"mrcjkb/haskell-tools.nvim",
version = false,
ft = { "haskell", "lhaskell", "cabal", "cabalproject" },
2024-03-07 11:51:08 +01:00
dependencies = {
{ "nvim-telescope/telescope.nvim", optional = true },
},
keys = {
{
"<leader>ce",
ft = "haskell",
"<cmd>HlsEvalAll<cr>",
desc = "Haskell Evaluate All",
},
{
"<leader>so",
ft = "haskell",
function()
require("haskell-tools").hoogle.hoogle_signature()
end,
desc = "Hoogle (Function Signature)",
},
LazyVim.has("telescope.nvim") and {
"<leader>sO",
ft = "haskell",
"<cmd>Telescope hoogle<cr>",
desc = "Hoogle (Global)",
} or nil,
{
"<leader>fl",
ft = "haskell",
function()
require("haskell-tools").repl.toggle()
end,
desc = "GHCi REPL (Package)",
},
{
"<leader>fL",
ft = "haskell",
function()
require("haskell-tools").repl.toggle(vim.api.nvim_buf_get_name(0))
end,
desc = "GHCi REPL (Current File)",
},
},
2024-03-07 11:51:08 +01:00
config = function()
local ok, telescope = pcall(require, "telescope")
2024-03-07 11:51:08 +01:00
if ok then
telescope.load_extension("ht")
2024-03-07 11:51:08 +01:00
end
end,
},
{
2025-05-12 10:39:04 +02:00
"mason-org/mason.nvim",
opts = { ensure_installed = { "haskell-language-server" } },
2024-03-07 11:51:08 +01:00
},
{
"mfussenegger/nvim-dap",
2024-03-07 11:51:08 +01:00
optional = true,
dependencies = {
{
2025-05-12 10:39:04 +02:00
"mason-org/mason.nvim",
opts = { ensure_installed = { "haskell-debug-adapter" } },
2024-03-07 11:51:08 +01:00
},
},
},
{
"nvim-neotest/neotest",
optional = true,
dependencies = {
{ "mrcjkb/neotest-haskell" },
2024-03-07 11:51:08 +01:00
},
opts = {
adapters = {
["neotest-haskell"] = {},
},
},
},
{
"mrcjkb/haskell-snippets.nvim",
dependencies = { "L3MON4D3/LuaSnip" },
ft = { "haskell", "lhaskell", "cabal", "cabalproject" },
2024-03-07 11:51:08 +01:00
config = function()
local haskell_snippets = require("haskell-snippets").all
require("luasnip").add_snippets("haskell", haskell_snippets, { key = "haskell" })
2024-03-07 11:51:08 +01:00
end,
},
{
"luc-tielen/telescope_hoogle",
ft = { "haskell", "lhaskell", "cabal", "cabalproject" },
2024-03-07 11:51:08 +01:00
dependencies = {
{ "nvim-telescope/telescope.nvim" },
},
config = function()
local ok, telescope = pcall(require, "telescope")
2024-03-07 11:51:08 +01:00
if ok then
telescope.load_extension("hoogle")
2024-03-07 11:51:08 +01:00
end
end,
},
{
"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" },
},
},
},
2024-03-07 11:51:08 +01:00
-- Make sure lspconfig doesn't start hls,
-- as it conflicts with haskell-tools
{
"neovim/nvim-lspconfig",
opts = {
setup = {
hls = function()
return true
2024-03-07 11:51:08 +01:00
end,
},
},
},
}