mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39: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
|
|
@ -1,2 +1,5 @@
|
|||
local opts = require("opts")
|
||||
opts.matchit_let_in()
|
||||
|
||||
vim.bo.shiftwidth = 2
|
||||
vim.bo.expandtab = true
|
||||
|
|
|
|||
|
|
@ -3,4 +3,6 @@ require("opts")
|
|||
|
||||
require("_lazy")
|
||||
|
||||
require("lsp.haskell")
|
||||
|
||||
vim.cmd.colorscheme("curry")
|
||||
|
|
|
|||
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,
|
||||
},
|
||||
}
|
||||
|
|
@ -187,47 +187,6 @@ vim.api.nvim_create_autocmd("FileType", {
|
|||
group = nvim_metals_group,
|
||||
})
|
||||
|
||||
-- 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 opts = { buffer = bufnr }
|
||||
|
||||
map("n", "<leader>hhe", ht.lsp.buf_eval_all, opts)
|
||||
map("n", "<leader>hhs", ht.hoogle.hoogle_signature, opts)
|
||||
map("n", "<leader>hhr", ht.repl.toggle, opts)
|
||||
|
||||
vim.opt_local.shiftwidth = 2
|
||||
mylsp.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,
|
||||
},
|
||||
}
|
||||
|
||||
----------
|
||||
-- Rust --
|
||||
----------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue