Skip to content

Commit

Permalink
feat(haskell): add neotest-haskell, haskell-snippets, and optional te…
Browse files Browse the repository at this point in the history
…lescope-hoogle to pack
  • Loading branch information
gacallea committed Nov 27, 2023
1 parent 2f04d6e commit f7e9f68
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 5 deletions.
19 changes: 17 additions & 2 deletions lua/astrocommunity/pack/haskell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,28 @@ Requires:

Optionally:

- A local hoogle installation
- [fast-tags](https://github.com/elaforge/fast-tags) (reccomended by haskell-tools)
- A local [hoogle](https://github.com/ndmitchell/hoogle) installation
(recommended by haskell-tools)
- [fast-tags](https://github.com/elaforge/fast-tags) (recommended by
haskell-tools)

This plugin pack does the following:

- Adds `haskell` treesitter parsers
- Adds `haskell-language-server` language server
- Adds `haskell-debug-adapter` dap adapter
- Adds [haskell-tools.nvim](https://github.com/mrcjkb/haskell-tools.nvim)
- Adds `yaml` language pack
- Adds `json` language pack
- Adds `neotest` from Astrocommunity
- Adds [neotest-haskell](https://github.com/mrcjkb/neotest-haskell)
- Adds [haskell-snippets.nvim](https://github.com/mrcjkb/haskell-snippets.nvim)

Optionally available:

> :warning: A local hoogle installation is required for this to work.
- Adds [telescope-hoogle](https://github.com/psiska/telescope-hoogle.nvim)

To install, set `{ "luc-tielen/telescope_hoogle", optional = false },` in
`user/plugins/core.lua` and install this pack as normal.
40 changes: 37 additions & 3 deletions lua/astrocommunity/pack/haskell/init.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
local utils = require "astronvim.utils"
local haskell_ft = { "haskell", "lhaskell", "cabal", "cabalproject" }
return {
{ import = "astrocommunity.pack.yaml" }, -- stack.yaml
{ import = "astrocommunity.pack.json" }, -- hls.json
{ import = "astrocommunity.test.neotest" }, -- neotest-haskell
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
Expand All @@ -12,14 +14,13 @@ return {
},
{
"mrcjkb/haskell-tools.nvim",
ft = haskell_ft,
dependencies = {
"nvim-lua/plenary.nvim",
{ "nvim-telescope/telescope.nvim", optional = true },
{ "mfussenegger/nvim-dap", optional = true },
},
version = "^2",
-- load the plugin when opening one of the following file types
ft = { "haskell", "lhaskell", "cabal", "cabalproject" },
version = "^2", -- version ^3 requires nvim >=0.9
init = function()
astronvim.lsp.skip_setup = utils.list_insert_unique(astronvim.lsp.skip_setup, "hls")
vim.g.haskell_tools = vim.tbl_deep_extend("keep", vim.g.haskell_tools or {}, {
Expand All @@ -37,4 +38,37 @@ return {
"jay-babu/mason-nvim-dap.nvim",
opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "haskell") end,
},
{
"mrcjkb/haskell-snippets.nvim",
ft = haskell_ft,
dependencies = { "L3MON4D3/LuaSnip" },
config = function()
local haskell_snippets = require("haskell-snippets").all
require("luasnip").add_snippets("haskell", haskell_snippets, { key = "haskell" })
end,
},
{
"luc-tielen/telescope_hoogle",
optional = true,
ft = haskell_ft,
dependencies = {
{ "nvim-telescope/telescope.nvim" },
},
config = function()
local ok, telescope = pcall(require, "telescope")
if ok then telescope.load_extension "hoogle" end
end,
},
{
"nvim-neotest/neotest",
ft = haskell_ft,
dependencies = {
{ "mrcjkb/neotest-haskell" },
},
opts = {
adapters = {
["neotest-haskell"] = {},
},
},
},
}

0 comments on commit f7e9f68

Please sign in to comment.