mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
nvim: move hls to lsp.haskell module
This commit is contained in:
parent
9c817814f2
commit
f1cd9b036f
4 changed files with 52 additions and 41 deletions
47
.config/nvim/lua/lsp/haskell.lua
Normal file
47
.config/nvim/lua/lsp/haskell.lua
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
local mylsp = require("lsp")
|
||||
local border = mylsp.border
|
||||
local on_attach = mylsp.on_attach
|
||||
|
||||
-- Haskell
|
||||
vim.g.haskell_tools = {
|
||||
tools = {
|
||||
log = { level = vim.log.levels.OFF },
|
||||
hover = {
|
||||
border = border,
|
||||
stylize_markdown = true,
|
||||
},
|
||||
},
|
||||
hls = {
|
||||
on_attach = function(client, bufnr)
|
||||
local ht = require("haskell-tools")
|
||||
local nnoremap = function(bind, callback, userargs)
|
||||
local args = userargs or {}
|
||||
args.buffer = bufnr
|
||||
vim.keymap.set("n", bind, callback, args)
|
||||
end
|
||||
|
||||
nnoremap("<leader>hhe", ht.lsp.buf_eval_all)
|
||||
nnoremap("<leader>hhs", ht.hoogle.hoogle_signature)
|
||||
nnoremap("<leader>hhr", ht.repl.toggle)
|
||||
|
||||
on_attach(client, bufnr)
|
||||
end,
|
||||
default_settings = {
|
||||
haskell = {
|
||||
checkProject = false, -- PERF: don't check the entire project on initial load
|
||||
formattingProvider = "fourmolu",
|
||||
plugin = {
|
||||
rename = {
|
||||
config = {
|
||||
diff = true, -- (experimental) rename across modules
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
settings = function(project_root)
|
||||
local ht = require("haskell-tools")
|
||||
return ht.lsp.load_hls_settings(project_root, { settings_file_pattern = "hls.json" })
|
||||
end,
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue