nvim: Enable LSP support for Haskell

With ghcide release v0.2.0 adding multi-component support this should
work more widely now. We still can have tags, so change the key binding
for jump to definition and drop key binding K for Hoogle.

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2020-06-03 12:35:15 +05:30
parent 01de471188
commit f40584b6a9
3 changed files with 3 additions and 3 deletions

View file

@ -2,7 +2,6 @@
" https://github.com/maxigit/vimrc/tree/2020/compiler
compiler stack
setlocal makeprg=stack\ build
setlocal keywordprg=:Hoogle
nmap <buffer> <LocalLeader>t :AsyncDo stack exec -- hasktags -x -c .<CR>
nmap <buffer> <LocalLeader>td :AsyncDo stack exec -- haskdogs<CR>

View file

@ -6,7 +6,7 @@ local on_attach = function(_, bufnr)
require'completion'.on_attach()
local opts = { noremap=true, silent=true }
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-]>', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.util.show_line_diagnostics()<CR>', opts)
@ -19,7 +19,7 @@ local on_attach = function(_, bufnr)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<Leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
end
local servers = { 'rust_analyzer' }
local servers = { 'ghcide', 'rust_analyzer' }
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
on_attach = on_attach,

View file

@ -82,6 +82,7 @@ let g:completion_chain_complete_list = {
\ {'mode': '<c-n>'}
\],
\ 'haskell': [
\ {'complete_items': ['lsp']},
\ {'mode': 'keyn'},
\ {'mode': 'tags'},
\ {'mode': '<c-p>'},