feat(langauges): Configure the haskell language server
This commit is contained in:
parent
6e0b394896
commit
199d202ddc
2 changed files with 47 additions and 0 deletions
46
lua/plugins/languages/haskell.lua
Normal file
46
lua/plugins/languages/haskell.lua
Normal file
|
@ -0,0 +1,46 @@
|
|||
return {
|
||||
'mrcjkb/haskell-tools.nvim',
|
||||
version = '^4',
|
||||
lazy = false, -- This plugin is already lazy
|
||||
cond = vim.fn.executable("haskell-language-server") ~= 0,
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function(ev)
|
||||
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||
|
||||
if client ~= nil and client.name == "haskell-tools.nvim" then
|
||||
local ht = require('haskell-tools')
|
||||
local bufnr = ev.buf
|
||||
|
||||
local map = function(keys, action, desc)
|
||||
local opts = { noremap = false, silent = true, buffer = bufnr }
|
||||
if desc ~= nil then
|
||||
opts.desc = desc
|
||||
end
|
||||
vim.keymap.set("n", keys, action, opts)
|
||||
end
|
||||
|
||||
-- haskell-language-server relies heavily on codeLenses,
|
||||
-- so auto-refresh (see advanced configuration) is enabled by default
|
||||
map('<space>lcl', vim.lsp.codelens.run, nil)
|
||||
|
||||
map('<space>lhs', ht.hoogle.hoogle_signature, "Hoogle search for the type signature of the definition under the cursor")
|
||||
|
||||
map('<space>lea', ht.lsp.buf_eval_all, "Evaluate all code snippets")
|
||||
|
||||
map('<leader>lrr', ht.repl.toggle, "Toggle a GHCi repl for the current package")
|
||||
|
||||
-- Toggle a GHCi repl for the current buffer
|
||||
map('<leader>lrb', function()
|
||||
ht.repl.toggle(vim.api.nvim_buf_get_name(0))
|
||||
end, nil)
|
||||
|
||||
map('<leader>lrq', ht.repl.quit, "Quit the current GHCi repl")
|
||||
|
||||
vim.notify("Just done seting up hls")
|
||||
end
|
||||
end
|
||||
})
|
||||
end,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue