diff --git a/autoload/SpaceVim/layers/lang/haskell.vim b/autoload/SpaceVim/layers/lang/haskell.vim index 785033217..78c10a4f2 100644 --- a/autoload/SpaceVim/layers/lang/haskell.vim +++ b/autoload/SpaceVim/layers/lang/haskell.vim @@ -4,19 +4,13 @@ function! SpaceVim#layers#lang#haskell#plugins() abort \ ['pbrisbin/vim-syntax-shakespeare', { 'on_ft': 'haskell' }], \ ] - if !s:use_lsp + if SpaceVim#layers#lsp#check_filetype('haskell') call add(plugins, ['eagletmt/neco-ghc', { 'on_ft': 'haskell' }]) endif return plugins endfunction -let s:use_lsp = 0 - -function! SpaceVim#layers#lang#haskell#set_variable(var) abort - let s:use_lsp = get(a:var, 'use_lsp', 0) && has('nvim') && executable('hie') -endfunction - function! SpaceVim#layers#lang#haskell#config() abort let g:haskellmode_completion_ghc = 0 @@ -26,7 +20,7 @@ function! SpaceVim#layers#lang#haskell#config() abort call SpaceVim#mapping#space#regesit_lang_mappings('haskell', \ funcref('s:on_ft')) - if s:use_lsp + if SpaceVim#layers#lsp#check_filetype('haskell') call SpaceVim#mapping#gd#add('haskell', \ function('SpaceVim#lsp#go_to_def')) call SpaceVim#lsp#reg_server('haskell', ['hie', '--lsp']) @@ -35,14 +29,14 @@ function! SpaceVim#layers#lang#haskell#config() abort augroup SpaceVim_lang_haskell autocmd! - if !s:use_lsp + if SpaceVim#layers#lsp#check_filetype('haskell') autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc endif augroup END endfunction function! s:on_ft() abort - if s:use_lsp + if SpaceVim#layers#lsp#check_filetype('haskell') nnoremap K :call SpaceVim#lsp#show_doc() call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'], diff --git a/autoload/SpaceVim/layers/lsp.vim b/autoload/SpaceVim/layers/lsp.vim index 4a350c95e..398fdffa8 100644 --- a/autoload/SpaceVim/layers/lsp.vim +++ b/autoload/SpaceVim/layers/lsp.vim @@ -69,6 +69,7 @@ let s:enabled_fts = [] let s:lsp_servers = { \ 'javascript' : ['javascript-typescript-stdio'], + \ 'haskell' : ['hie', '--lsp'], \ } function! SpaceVim#layers#lsp#set_variable(var) abort diff --git a/docs/layers/lang/haskell.md b/docs/layers/lang/haskell.md index 94c9cbb2b..453eefc46 100644 --- a/docs/layers/lang/haskell.md +++ b/docs/layers/lang/haskell.md @@ -27,4 +27,5 @@ To use this configuration layer, add `call SpaceVim#layers#load('lang#haskell')` - syntax checking - goto definition - refernce finder +- language server protocol (need lsp layer) diff --git a/docs/layers/language-server-protocol.md b/docs/layers/language-server-protocol.md index ef61f73dd..aca0bb5aa 100644 --- a/docs/layers/language-server-protocol.md +++ b/docs/layers/language-server-protocol.md @@ -44,6 +44,7 @@ default language server commands: | language | server command | | ------------ | --------------------------------- | | `javascript` | `['javascript-typescript-stdio']` | +| `haskell` | `['hie', '--lsp']` | To override the server command, you may need to use `override_cmd` option: