mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -4,19 +4,14 @@
|
||||
call ale#Set('haskell_hdevtools_executable', 'hdevtools')
|
||||
call ale#Set('haskell_hdevtools_options', get(g:, 'hdevtools_options', '-g -Wall'))
|
||||
|
||||
function! ale_linters#haskell#hdevtools#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'haskell_hdevtools_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#haskell#hdevtools#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#haskell#hdevtools#GetExecutable(a:buffer))
|
||||
\ . ' check ' . ale#Var(a:buffer, 'haskell_hdevtools_options')
|
||||
\ . ' -p %s %t'
|
||||
return '%e check' . ale#Pad(ale#Var(a:buffer, 'haskell_hdevtools_options'))
|
||||
\ . ' -p %s %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'hdevtools',
|
||||
\ 'executable_callback': 'ale_linters#haskell#hdevtools#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('haskell_hdevtools_executable'),
|
||||
\ 'command_callback': 'ale_linters#haskell#hdevtools#GetCommand',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
44
sources_non_forked/ale/ale_linters/haskell/hie.vim
Normal file
44
sources_non_forked/ale/ale_linters/haskell/hie.vim
Normal file
@ -0,0 +1,44 @@
|
||||
" Author: Luxed <devildead13@gmail.com>
|
||||
" Description: A language server for Haskell
|
||||
|
||||
call ale#Set('haskell_hie_executable', 'hie')
|
||||
|
||||
function! ale_linters#haskell#hie#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'haskell_hie_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#haskell#hie#GetProjectRoot(buffer) abort
|
||||
" Search for the stack file first
|
||||
let l:project_file = ale#path#FindNearestFile(a:buffer, 'stack.yaml')
|
||||
|
||||
" If it's empty, search for the cabal file
|
||||
if empty(l:project_file)
|
||||
let l:cabal_file = fnamemodify(bufname(a:buffer), ':p:h')
|
||||
let l:paths = ''
|
||||
|
||||
while empty(matchstr(l:cabal_file, '^\(\/\|\(\w:\\\)\)$'))
|
||||
let l:cabal_file = fnamemodify(l:cabal_file, ':h')
|
||||
let l:paths = l:paths . l:cabal_file . ','
|
||||
endwhile
|
||||
|
||||
let l:project_file = globpath(l:paths, '*.cabal')
|
||||
endif
|
||||
|
||||
" Either extract the project directory or take the current working
|
||||
" directory
|
||||
if !empty(l:project_file)
|
||||
let l:project_file = fnamemodify(l:project_file, ':h')
|
||||
else
|
||||
let l:project_file = expand('#' . a:buffer . ':p:h')
|
||||
endif
|
||||
|
||||
return l:project_file
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'hie',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'command': '%e --lsp',
|
||||
\ 'executable_callback': 'ale_linters#haskell#hie#GetExecutable',
|
||||
\ 'project_root_callback': 'ale_linters#haskell#hie#GetProjectRoot',
|
||||
\})
|
Reference in New Issue
Block a user