diff --git a/lua/astrocommunity/pack/haskell/init.lua b/lua/astrocommunity/pack/haskell/init.lua index a2aecf013..fd79dc4e9 100644 --- a/lua/astrocommunity/pack/haskell/init.lua +++ b/lua/astrocommunity/pack/haskell/init.lua @@ -12,33 +12,24 @@ return { }, { "mrcjkb/haskell-tools.nvim", - ft = { "haskell" }, - branch = "1.x.x", -- recommended by haskell-tools - init = function() astronvim.lsp.skip_setup = 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, - }, - }, - config = function(_, opts) - local tools = require "haskell-tools" - vim.api.nvim_create_autocmd("Filetype", { - pattern = "haskell", -- autocmd to start haskell-tools - callback = function() 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 tools.dap.discover_configurations(args.buf) end - end, - }) - end, dependencies = { "nvim-lua/plenary.nvim", - "nvim-telescope/telescope.nvim", -- optional + { "nvim-telescope/telescope.nvim", optional = true }, -- Optional }, + branch = "2.x.x", -- Recommended + init = function() -- Optional, see Advanced configuration + astronvim.lsp.skip_setup = utils.list_insert_unique(astronvim.lsp.skip_setup, "hls") + vim.g.haskell_tools = { + hls = { + on_attach = function(client, bufnr, ht) + require("astronvim.utils.lsp").on_attach(client, bufnr) + ht.dap.discover_configurations(bufnr) + end, + }, + } + end, + -- load the plugin when opening one of the following file types + ft = { "haskell", "lhaskell", "cabal", "cabalproject" }, }, { "williamboman/mason-lspconfig.nvim",