mirror of
https://github.com/amix/vimrc
synced 2025-08-02 02:44:59 +08:00
Updated plugins
This commit is contained in:
@ -14,6 +14,6 @@ call ale#linter#Define('haskell', {
|
||||
\ 'aliases': ['cabal-ghc'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'cabal',
|
||||
\ 'command_callback': 'ale_linters#haskell#cabal_ghc#GetCommand',
|
||||
\ 'command': function('ale_linters#haskell#cabal_ghc#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
@ -13,6 +13,6 @@ call ale#linter#Define('haskell', {
|
||||
\ 'name': 'ghc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'ghc',
|
||||
\ 'command_callback': 'ale_linters#haskell#ghc#GetCommand',
|
||||
\ 'command': function('ale_linters#haskell#ghc#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
@ -13,7 +13,7 @@ endfunction
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'ghc_mod',
|
||||
\ 'aliases': ['ghc-mod'],
|
||||
\ 'executable_callback': ale#VarFunc('haskell_ghc_mod_executable'),
|
||||
\ 'command_callback': 'ale_linters#haskell#ghc_mod#GetCommand',
|
||||
\ 'executable': {b -> ale#Var(b, 'haskell_ghc_mod_executable')},
|
||||
\ 'command': function('ale_linters#haskell#ghc_mod#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
@ -14,7 +14,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'hdevtools',
|
||||
\ 'executable_callback': ale#VarFunc('haskell_hdevtools_executable'),
|
||||
\ 'command_callback': 'ale_linters#haskell#hdevtools#GetCommand',
|
||||
\ 'executable': {b -> ale#Var(b, 'haskell_hdevtools_executable')},
|
||||
\ 'command': function('ale_linters#haskell#hdevtools#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
@ -9,39 +9,33 @@ function! ale_linters#haskell#hie#GetProjectRoot(buffer) abort
|
||||
|
||||
" 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
|
||||
|
||||
" Search all of the paths except for the root filesystem path.
|
||||
let l:paths = join(
|
||||
\ ale#path#Upwards(expand('#' . a:buffer . ':p:h'))[:-2],
|
||||
\ ','
|
||||
\)
|
||||
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')
|
||||
" If we still can't find one, use the current file.
|
||||
if empty(l:project_file)
|
||||
let l:project_file = expand('#' . a:buffer . ':p')
|
||||
endif
|
||||
|
||||
return l:project_file
|
||||
return fnamemodify(l:project_file, ':h')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#haskell#hie#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'haskell_hie_executable')
|
||||
|
||||
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hie')
|
||||
\ . ' --lsp'
|
||||
\ . ' --lsp'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'hie',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'command_callback': 'ale_linters#haskell#hie#GetCommand',
|
||||
\ 'executable_callback': ale#VarFunc('haskell_hie_executable'),
|
||||
\ 'project_root_callback': 'ale_linters#haskell#hie#GetProjectRoot',
|
||||
\ 'command': function('ale_linters#haskell#hie#GetCommand'),
|
||||
\ 'executable': {b -> ale#Var(b, 'haskell_hie_executable')},
|
||||
\ 'project_root': function('ale_linters#haskell#hie#GetProjectRoot'),
|
||||
\})
|
||||
|
@ -40,7 +40,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'hlint',
|
||||
\ 'executable_callback': ale#VarFunc('haskell_hlint_executable'),
|
||||
\ 'command_callback': 'ale_linters#haskell#hlint#GetCommand' ,
|
||||
\ 'executable': {b -> ale#Var(b, 'haskell_hlint_executable')},
|
||||
\ 'command': function('ale_linters#haskell#hlint#GetCommand') ,
|
||||
\ 'callback': 'ale_linters#haskell#hlint#Handle',
|
||||
\})
|
||||
|
@ -16,8 +16,8 @@ call ale#linter#Define('haskell', {
|
||||
\ 'name': 'stack_build',
|
||||
\ 'aliases': ['stack-build'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale#handlers#haskell#GetStackExecutable',
|
||||
\ 'command_callback': 'ale_linters#haskell#stack_build#GetCommand',
|
||||
\ 'executable': function('ale#handlers#haskell#GetStackExecutable'),
|
||||
\ 'command': function('ale_linters#haskell#stack_build#GetCommand'),
|
||||
\ 'lint_file': 1,
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
@ -1,11 +1,20 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: ghc for Haskell files, using Stack
|
||||
|
||||
call ale#Set('haskell_stack_ghc_options', '-fno-code -v0')
|
||||
|
||||
function! ale_linters#haskell#stack_ghc#GetCommand(buffer) abort
|
||||
return ale#handlers#haskell#GetStackExecutable(a:buffer)
|
||||
\ . ' ghc -- '
|
||||
\ . ale#Var(a:buffer, 'haskell_stack_ghc_options')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'stack_ghc',
|
||||
\ 'aliases': ['stack-ghc'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale#handlers#haskell#GetStackExecutable',
|
||||
\ 'command': 'stack ghc -- -fno-code -v0 %t',
|
||||
\ 'executable': function('ale#handlers#haskell#GetStackExecutable'),
|
||||
\ 'command': function('ale_linters#haskell#stack_ghc#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
Reference in New Issue
Block a user