Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: haskell-debug-adapter #1

Merged
merged 6 commits into from
May 2, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 34 additions & 10 deletions lua/astrocommunity/pack/haskell/haskell.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
local utils = require "astronvim.utils"
local utils = require "astrocommunity.utils"
sjcobb2022 marked this conversation as resolved.
Show resolved Hide resolved
return {
{ import = "astrocommunity.pack.yaml" }, -- stack.yaml
{ import = "astrocommunity.pack.json" }, -- hls.json
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if opts.ensure_installed ~= "all" then
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "haskell")
-- Ensure that opts.ensure_installed exists and is a table or string "all".
if not opts.ensure_installed then
opts.ensure_installed = {}
elseif opts.ensure_installed == "all" then
return
end
-- ensure haskell treesitter installed
utils.list_insert_unique(opts.ensure_installed, "haskell")
end,
},

sjcobb2022 marked this conversation as resolved.
Show resolved Hide resolved
{
"mrcjkb/haskell-tools.nvim",
ft = { "haskell" },
branch = "1.x.x", -- reccomended by haskell-tools
init = function() astronvim.lsp.skip_setup = utils.list_insert_unique(astronvim.lsp.skip_setup, "hls") end,
sjcobb2022 marked this conversation as resolved.
Show resolved Hide resolved
init = function() utils.list_insert_unique(astronvim.lsp.skip_setup, "hls") end,
opts = {
hls = {
on_attach = function(client, bufnr) require("astronvim.utils.lsp").on_attach(client, bufnr) end,
Expand All @@ -23,20 +29,38 @@ return {
config = function(_, opts)
vim.api.nvim_create_autocmd("Filetype", {
pattern = "haskell", -- autocmd to start haskell-tools
callback = function(_) require("haskell-tools").start_or_attach(opts) end,
callback = function() require("haskell-tools").start_or_attach(opts) end,
})

vim.api.nvim_create_autocmd("LspAttach", {
pattern = "*.hs", -- autocmd to start haskell-tools
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client.name == "haskell-tools.nvim" then require("haskell-tools").dap.discover_configurations(args.buf) end
end,
})
end,
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim", -- optional
{
"jay-babu/mason-nvim-dap.nvim",
opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "haskell") end,
},
sjcobb2022 marked this conversation as resolved.
Show resolved Hide resolved
},
},

sjcobb2022 marked this conversation as resolved.
Show resolved Hide resolved
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "hls") end,
opts = function(_, opts)
-- Ensure that opts.ensure_installed exists and is a table.
if not opts.ensure_installed then opts.ensure_installed = {} end
utils.list_insert_unique(opts.ensure_installed, "hls")
end,
},

{
"jay-babu/mason-nvim-dap.nvim",
opts = function(_, opts)
-- Ensure that opts.ensure_installed exists and is a table.
if not opts.ensure_installed then opts.ensure_installed = {} end
utils.list_insert_unique(opts.ensure_installed, "haskell")
end,
sjcobb2022 marked this conversation as resolved.
Show resolved Hide resolved
},
}