mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Removed syntastic and replaced it with ale
Read more here: https://github.com/w0rp/ale
This commit is contained in:
16
sources_non_forked/ale/ale_linters/haskell/ghc-mod.vim
Normal file
16
sources_non_forked/ale/ale_linters/haskell/ghc-mod.vim
Normal file
@ -0,0 +1,16 @@
|
||||
" Author: wizzup <wizzup@gmail.com>
|
||||
" Description: ghc-mod for Haskell files
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'ghc-mod',
|
||||
\ 'executable': 'ghc-mod',
|
||||
\ 'command': 'ghc-mod --map-file %s=%t check %s',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'stack-ghc-mod',
|
||||
\ 'executable': 'stack',
|
||||
\ 'command': 'stack exec ghc-mod -- --map-file %s=%t check %s',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
18
sources_non_forked/ale/ale_linters/haskell/ghc.vim
Normal file
18
sources_non_forked/ale/ale_linters/haskell/ghc.vim
Normal file
@ -0,0 +1,18 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: ghc for Haskell files
|
||||
|
||||
call ale#Set('haskell_ghc_options', '-fno-code -v0')
|
||||
|
||||
function! ale_linters#haskell#ghc#GetCommand(buffer) abort
|
||||
return 'ghc '
|
||||
\ . ale#Var(a:buffer, 'haskell_ghc_options')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'ghc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'ghc',
|
||||
\ 'command_callback': 'ale_linters#haskell#ghc#GetCommand',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
22
sources_non_forked/ale/ale_linters/haskell/hdevtools.vim
Normal file
22
sources_non_forked/ale/ale_linters/haskell/hdevtools.vim
Normal file
@ -0,0 +1,22 @@
|
||||
" Author: rob-b, Takano Akio <tak@anoak.io>
|
||||
" Description: hdevtools for Haskell files
|
||||
|
||||
call ale#Set('haskell_hdevtools_executable', 'hdevtools')
|
||||
call ale#Set('haskell_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'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'hdevtools',
|
||||
\ 'executable_callback': 'ale_linters#haskell#hdevtools#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#haskell#hdevtools#GetCommand',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
34
sources_non_forked/ale/ale_linters/haskell/hlint.vim
Normal file
34
sources_non_forked/ale/ale_linters/haskell/hlint.vim
Normal file
@ -0,0 +1,34 @@
|
||||
" Author: jparoz <jesse.paroz@gmail.com>
|
||||
" Description: hlint for Haskell files
|
||||
|
||||
function! ale_linters#haskell#hlint#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
||||
if l:error.severity is# 'Error'
|
||||
let l:type = 'E'
|
||||
elseif l:error.severity is# 'Suggestion'
|
||||
let l:type = 'I'
|
||||
else
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:error.startLine),
|
||||
\ 'col': str2nr(l:error.startColumn),
|
||||
\ 'end_lnum': str2nr(l:error.endLine),
|
||||
\ 'end_col': str2nr(l:error.endColumn),
|
||||
\ 'text': l:error.severity . ': ' . l:error.hint . '. Found: ' . l:error.from . ' Why not: ' . l:error.to,
|
||||
\ 'type': l:type,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'hlint',
|
||||
\ 'executable': 'hlint',
|
||||
\ 'command': 'hlint --color=never --json -',
|
||||
\ 'callback': 'ale_linters#haskell#hlint#Handle',
|
||||
\})
|
22
sources_non_forked/ale/ale_linters/haskell/stack_build.vim
Normal file
22
sources_non_forked/ale/ale_linters/haskell/stack_build.vim
Normal file
@ -0,0 +1,22 @@
|
||||
" Author: Jake Zimmerman <jake@zimmerman.io>
|
||||
" Description: Like stack-ghc, but for entire projects
|
||||
"
|
||||
" Note: Ideally, this would *only* typecheck. Right now, it also does codegen.
|
||||
" See <https://github.com/commercialhaskell/stack/issues/977>.
|
||||
|
||||
call ale#Set('haskell_stack_build_options', '--fast')
|
||||
|
||||
function! ale_linters#haskell#stack_build#GetCommand(buffer) abort
|
||||
let l:flags = ale#Var(a:buffer, 'haskell_stack_build_options')
|
||||
|
||||
return 'stack build ' . l:flags
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'stack-build',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'stack',
|
||||
\ 'command_callback': 'ale_linters#haskell#stack_build#GetCommand',
|
||||
\ 'lint_file': 1,
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
10
sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim
Normal file
10
sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim
Normal file
@ -0,0 +1,10 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: ghc for Haskell files, using Stack
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'stack-ghc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'stack',
|
||||
\ 'command': 'stack ghc -- -fno-code -v0 %t',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
Reference in New Issue
Block a user