mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-13 13:19:12 +08:00
Fix haskell layer
This commit is contained in:
parent
b40a235ecf
commit
afaeeb1e58
@ -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 <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
|
||||
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user