mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-14 15: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' }],
|
\ ['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' }])
|
call add(plugins, ['eagletmt/neco-ghc', { 'on_ft': 'haskell' }])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return plugins
|
return plugins
|
||||||
endfunction
|
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
|
function! SpaceVim#layers#lang#haskell#config() abort
|
||||||
let g:haskellmode_completion_ghc = 0
|
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',
|
call SpaceVim#mapping#space#regesit_lang_mappings('haskell',
|
||||||
\ funcref('s:on_ft'))
|
\ funcref('s:on_ft'))
|
||||||
|
|
||||||
if s:use_lsp
|
if SpaceVim#layers#lsp#check_filetype('haskell')
|
||||||
call SpaceVim#mapping#gd#add('haskell',
|
call SpaceVim#mapping#gd#add('haskell',
|
||||||
\ function('SpaceVim#lsp#go_to_def'))
|
\ function('SpaceVim#lsp#go_to_def'))
|
||||||
call SpaceVim#lsp#reg_server('haskell', ['hie', '--lsp'])
|
call SpaceVim#lsp#reg_server('haskell', ['hie', '--lsp'])
|
||||||
@ -35,14 +29,14 @@ function! SpaceVim#layers#lang#haskell#config() abort
|
|||||||
augroup SpaceVim_lang_haskell
|
augroup SpaceVim_lang_haskell
|
||||||
autocmd!
|
autocmd!
|
||||||
|
|
||||||
if !s:use_lsp
|
if SpaceVim#layers#lsp#check_filetype('haskell')
|
||||||
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
|
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
|
||||||
endif
|
endif
|
||||||
augroup END
|
augroup END
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_ft() abort
|
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>
|
nnoremap <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
|
||||||
|
|
||||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
|
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
|
||||||
|
@ -69,6 +69,7 @@ let s:enabled_fts = []
|
|||||||
|
|
||||||
let s:lsp_servers = {
|
let s:lsp_servers = {
|
||||||
\ 'javascript' : ['javascript-typescript-stdio'],
|
\ 'javascript' : ['javascript-typescript-stdio'],
|
||||||
|
\ 'haskell' : ['hie', '--lsp'],
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
function! SpaceVim#layers#lsp#set_variable(var) abort
|
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
|
- syntax checking
|
||||||
- goto definition
|
- goto definition
|
||||||
- refernce finder
|
- refernce finder
|
||||||
|
- language server protocol (need lsp layer)
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ default language server commands:
|
|||||||
| language | server command |
|
| language | server command |
|
||||||
| ------------ | --------------------------------- |
|
| ------------ | --------------------------------- |
|
||||||
| `javascript` | `['javascript-typescript-stdio']` |
|
| `javascript` | `['javascript-typescript-stdio']` |
|
||||||
|
| `haskell` | `['hie', '--lsp']` |
|
||||||
|
|
||||||
To override the server command, you may need to use `override_cmd` option:
|
To override the server command, you may need to use `override_cmd` option:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user