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:
parent
01de471188
commit
f40584b6a9
3 changed files with 3 additions and 3 deletions
|
@ -2,7 +2,6 @@
|
||||||
" https://github.com/maxigit/vimrc/tree/2020/compiler
|
" https://github.com/maxigit/vimrc/tree/2020/compiler
|
||||||
compiler stack
|
compiler stack
|
||||||
setlocal makeprg=stack\ build
|
setlocal makeprg=stack\ build
|
||||||
setlocal keywordprg=:Hoogle
|
|
||||||
|
|
||||||
nmap <buffer> <LocalLeader>t :AsyncDo stack exec -- hasktags -x -c .<CR>
|
nmap <buffer> <LocalLeader>t :AsyncDo stack exec -- hasktags -x -c .<CR>
|
||||||
nmap <buffer> <LocalLeader>td :AsyncDo stack exec -- haskdogs<CR>
|
nmap <buffer> <LocalLeader>td :AsyncDo stack exec -- haskdogs<CR>
|
||||||
|
|
|
@ -6,7 +6,7 @@ local on_attach = function(_, bufnr)
|
||||||
require'completion'.on_attach()
|
require'completion'.on_attach()
|
||||||
|
|
||||||
local opts = { noremap=true, silent=true }
|
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', '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', '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)
|
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)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<Leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
local servers = { 'rust_analyzer' }
|
local servers = { 'ghcide', 'rust_analyzer' }
|
||||||
for _, lsp in ipairs(servers) do
|
for _, lsp in ipairs(servers) do
|
||||||
nvim_lsp[lsp].setup {
|
nvim_lsp[lsp].setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
|
|
|
@ -82,6 +82,7 @@ let g:completion_chain_complete_list = {
|
||||||
\ {'mode': '<c-n>'}
|
\ {'mode': '<c-n>'}
|
||||||
\],
|
\],
|
||||||
\ 'haskell': [
|
\ 'haskell': [
|
||||||
|
\ {'complete_items': ['lsp']},
|
||||||
\ {'mode': 'keyn'},
|
\ {'mode': 'keyn'},
|
||||||
\ {'mode': 'tags'},
|
\ {'mode': 'tags'},
|
||||||
\ {'mode': '<c-p>'},
|
\ {'mode': '<c-p>'},
|
||||||
|
|
Loading…
Reference in a new issue