mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-08 22:45:30 +00:00
languages/haskell: share common lsp configuration
Some of the LSP configuration is common for both `haskell-tools` and `hls`. Make them consistent with attrset updates.
This commit is contained in:
parent
e3ddf6de6a
commit
2a21c8570e
1 changed files with 44 additions and 38 deletions
|
|
@ -19,46 +19,52 @@
|
||||||
cfg = config.vim.languages.haskell;
|
cfg = config.vim.languages.haskell;
|
||||||
|
|
||||||
defaultServers = ["hls"];
|
defaultServers = ["hls"];
|
||||||
|
serverCommon = {
|
||||||
|
filetypes = ["haskell" "lhaskell"];
|
||||||
|
root_dir =
|
||||||
|
mkLuaInline
|
||||||
|
/*
|
||||||
|
lua
|
||||||
|
*/
|
||||||
|
''
|
||||||
|
function(bufnr, on_dir)
|
||||||
|
local fname = vim.api.nvim_buf_get_name(bufnr)
|
||||||
|
on_dir(util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project', '*.cabal', 'package.yaml')(fname))
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
servers = {
|
servers = {
|
||||||
hls = {
|
hls =
|
||||||
enable = true;
|
serverCommon
|
||||||
cmd = [ "haskell-language-server-wrapper" "--lsp" ];
|
// {
|
||||||
filetypes = ["haskell" "lhaskell"];
|
enable = true;
|
||||||
root_dir =
|
cmd = ["haskell-language-server-wrapper" "--lsp"];
|
||||||
mkLuaInline
|
};
|
||||||
/*
|
|
||||||
lua
|
|
||||||
*/
|
|
||||||
''
|
|
||||||
function(bufnr, on_dir)
|
|
||||||
local fname = vim.api.nvim_buf_get_name(bufnr)
|
|
||||||
on_dir(util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project', '*.cabal', 'package.yaml')(fname))
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
haskell-tools = {
|
haskell-tools =
|
||||||
enable = true;
|
serverCommon
|
||||||
on_attach =
|
// {
|
||||||
mkLuaInline
|
enable = false;
|
||||||
/*
|
on_attach =
|
||||||
lua
|
mkLuaInline
|
||||||
*/
|
/*
|
||||||
''
|
lua
|
||||||
function(client, bufnr)
|
*/
|
||||||
local ht = require("haskell-tools")
|
''
|
||||||
local opts = { noremap = true, silent = true, buffer = bufnr }
|
function(client, bufnr)
|
||||||
vim.keymap.set('n', '<localleader>cl', vim.lsp.codelens.run, opts)
|
local ht = require("haskell-tools")
|
||||||
vim.keymap.set('n', '<localleader>hs', ht.hoogle.hoogle_signature, opts)
|
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
vim.keymap.set('n', '<localleader>ea', ht.lsp.buf_eval_all, opts)
|
vim.keymap.set('n', '<localleader>cl', vim.lsp.codelens.run, opts)
|
||||||
vim.keymap.set('n', '<localleader>rr', ht.repl.toggle, opts)
|
vim.keymap.set('n', '<localleader>hs', ht.hoogle.hoogle_signature, opts)
|
||||||
vim.keymap.set('n', '<localleader>rf', function()
|
vim.keymap.set('n', '<localleader>ea', ht.lsp.buf_eval_all, opts)
|
||||||
ht.repl.toggle(vim.api.nvim_buf_get_name(0))
|
vim.keymap.set('n', '<localleader>rr', ht.repl.toggle, opts)
|
||||||
end, opts)
|
vim.keymap.set('n', '<localleader>rf', function()
|
||||||
vim.keymap.set('n', '<localleader>rq', ht.repl.quit, opts)
|
ht.repl.toggle(vim.api.nvim_buf_get_name(0))
|
||||||
end
|
end, opts)
|
||||||
'';
|
vim.keymap.set('n', '<localleader>rq', ht.repl.quit, opts)
|
||||||
};
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
options.vim.languages.haskell = {
|
options.vim.languages.haskell = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue