-
-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pack): add haskell language pack (#165)
* added haskell tools * add on_attach and extra print * add empty input in autocmd callback * added ddebug messages and require telescope * add filetype loading * remove debug messages * add check for server_capabilities * add astronvim.lsp.on_attach to attach lsp keymap * cleanup and finalize readme
- Loading branch information
1 parent
b983cd0
commit bceb4c4
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Haskell Language Pack | ||
|
||
Requires: | ||
|
||
- plenary.nvim | ||
|
||
Optionally: | ||
|
||
- A local hoogle installation | ||
- [fast-tags](https://github.com/elaforge/fast-tags) (reccomended by haskell-tools) | ||
|
||
This plugin pack does the following: | ||
|
||
- Adds `haskell` treesitter parsers | ||
- Adds `haskell-language-server` language server | ||
- Adds [haskell-tools.nvim](https://github.com/mrcjkb/haskell-tools.nvim) | ||
- Adds `yaml` language pack | ||
- Adds `json` language pack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
local utils = require "astrocommunity.utils" | ||
return { | ||
{ import = "astrocommunity.pack.yaml" }, -- stack.yaml | ||
{ import = "astrocommunity.pack.json" }, -- hls.json | ||
{ | ||
"nvim-treesitter/nvim-treesitter", | ||
opts = function(_, opts) | ||
-- 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, | ||
}, | ||
{ | ||
"mrcjkb/haskell-tools.nvim", | ||
ft = { "haskell" }, | ||
branch = "1.x.x", -- reccomended by haskell-tools | ||
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, | ||
}, | ||
}, | ||
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, | ||
}) | ||
end, | ||
dependencies = { | ||
"nvim-lua/plenary.nvim", | ||
"nvim-telescope/telescope.nvim", -- optional | ||
-- TODO: Need haskell to be pulled into mason-nvim-dap (haskell hopefully coming soon) | ||
-- { | ||
-- "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-dap") | ||
-- end, | ||
-- }, | ||
}, | ||
}, | ||
{ | ||
"williamboman/mason-lspconfig.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, "hls") | ||
end, | ||
}, | ||
} |