mirror of
https://github.com/amix/vimrc
synced 2025-07-09 18:55:01 +08:00
gitignore sources_non_forked_cache
This commit is contained in:
20
sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim
Normal file
20
sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim
Normal file
@ -0,0 +1,20 @@
|
||||
" Author: Eric Wolf <ericwolf42@gmail.com>
|
||||
" Description: ghc for Haskell files called with cabal exec
|
||||
|
||||
call ale#Set('haskell_cabal_ghc_options', '-fno-code -v0')
|
||||
|
||||
function! ale_linters#haskell#cabal_ghc#GetCommand(buffer) abort
|
||||
return 'cabal exec -- ghc '
|
||||
\ . ale#Var(a:buffer, 'haskell_cabal_ghc_options')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'cabal_ghc',
|
||||
\ 'aliases': ['cabal-ghc'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'cabal',
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#haskell#cabal_ghc#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/haskell/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/haskell/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Haskell files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('haskell')
|
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': function('ale_linters#haskell#ghc#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
19
sources_non_forked/ale/ale_linters/haskell/ghc_mod.vim
Normal file
19
sources_non_forked/ale/ale_linters/haskell/ghc_mod.vim
Normal file
@ -0,0 +1,19 @@
|
||||
" Author: wizzup <wizzup@gmail.com>
|
||||
" Description: ghc-mod for Haskell files
|
||||
|
||||
call ale#Set('haskell_ghc_mod_executable', 'ghc-mod')
|
||||
|
||||
function! ale_linters#haskell#ghc_mod#GetCommand (buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'haskell_ghc_mod_executable')
|
||||
|
||||
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'ghc-mod')
|
||||
\ . ' --map-file %s=%t check %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'ghc_mod',
|
||||
\ 'aliases': ['ghc-mod'],
|
||||
\ 'executable': {b -> ale#Var(b, 'haskell_ghc_mod_executable')},
|
||||
\ 'command': function('ale_linters#haskell#ghc_mod#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
20
sources_non_forked/ale/ale_linters/haskell/hdevtools.vim
Normal file
20
sources_non_forked/ale/ale_linters/haskell/hdevtools.vim
Normal file
@ -0,0 +1,20 @@
|
||||
" 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', get(g:, 'hdevtools_options', '-g -Wall'))
|
||||
|
||||
function! ale_linters#haskell#hdevtools#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'haskell_hdevtools_executable')
|
||||
|
||||
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hdevtools')
|
||||
\ . ' check' . ale#Pad(ale#Var(a:buffer, 'haskell_hdevtools_options'))
|
||||
\ . ' -p %s %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'hdevtools',
|
||||
\ 'executable': {b -> ale#Var(b, 'haskell_hdevtools_executable')},
|
||||
\ 'command': function('ale_linters#haskell#hdevtools#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
41
sources_non_forked/ale/ale_linters/haskell/hie.vim
Normal file
41
sources_non_forked/ale/ale_linters/haskell/hie.vim
Normal file
@ -0,0 +1,41 @@
|
||||
" Author: Luxed <devildead13@gmail.com>
|
||||
" Description: A language server for Haskell
|
||||
|
||||
call ale#Set('haskell_hie_executable', 'hie')
|
||||
|
||||
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)
|
||||
" 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
|
||||
|
||||
" 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 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'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'hie',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'command': function('ale_linters#haskell#hie#GetCommand'),
|
||||
\ 'executable': {b -> ale#Var(b, 'haskell_hie_executable')},
|
||||
\ 'project_root': function('ale_linters#haskell#hie#GetProjectRoot'),
|
||||
\})
|
46
sources_non_forked/ale/ale_linters/haskell/hlint.vim
Normal file
46
sources_non_forked/ale/ale_linters/haskell/hlint.vim
Normal file
@ -0,0 +1,46 @@
|
||||
" Author: jparoz <jesse.paroz@gmail.com>
|
||||
" Description: hlint for Haskell files
|
||||
|
||||
call ale#Set('haskell_hlint_executable', 'hlint')
|
||||
call ale#Set('haskell_hlint_options', get(g:, 'hlint_options', ''))
|
||||
|
||||
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
|
||||
|
||||
function! ale_linters#haskell#hlint#GetCommand(buffer) abort
|
||||
let l:hlintopts = '--color=never --json'
|
||||
|
||||
return ale#handlers#hlint#GetExecutable(a:buffer)
|
||||
\ . ' ' . ale#Var(a:buffer, 'haskell_hlint_options')
|
||||
\ . ' ' . l:hlintopts
|
||||
\ . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'hlint',
|
||||
\ 'executable': {b -> ale#Var(b, 'haskell_hlint_executable')},
|
||||
\ 'command': function('ale_linters#haskell#hlint#GetCommand') ,
|
||||
\ 'callback': 'ale_linters#haskell#hlint#Handle',
|
||||
\})
|
65
sources_non_forked/ale/ale_linters/haskell/hls.vim
Normal file
65
sources_non_forked/ale/ale_linters/haskell/hls.vim
Normal file
@ -0,0 +1,65 @@
|
||||
" Author: Yen3 <yen3rc@gmail.com>
|
||||
" Description: A language server for haskell
|
||||
" The file is based on hie.vim (author: Luxed
|
||||
" <devildead13@gmail.com>). It search more project root files.
|
||||
"
|
||||
call ale#Set('haskell_hls_executable', 'haskell-language-server-wrapper')
|
||||
call ale#Set('haskell_hls_config', {})
|
||||
|
||||
function! ale_linters#haskell#hls#FindRootFile(buffer) abort
|
||||
let l:serach_root_files = [
|
||||
\ 'stack.yaml',
|
||||
\ 'cabal.project',
|
||||
\ 'package.yaml',
|
||||
\ 'hie.yaml'
|
||||
\ ]
|
||||
|
||||
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
|
||||
for l:root_file in l:serach_root_files
|
||||
if filereadable(l:path . l:root_file)
|
||||
return l:path
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#haskell#hls#GetProjectRoot(buffer) abort
|
||||
" Search for the project file first
|
||||
let l:project_file = ale_linters#haskell#hls#FindRootFile(a:buffer)
|
||||
|
||||
" If it's empty, search for the cabal file
|
||||
if empty(l:project_file)
|
||||
" 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
|
||||
|
||||
" 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 fnamemodify(l:project_file, ':h')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#haskell#hls#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'haskell_hls_executable')
|
||||
|
||||
return ale#handlers#haskell_stack#EscapeExecutable(l:executable,
|
||||
\ 'haskell-language-server-wrapper')
|
||||
\ . ' --lsp'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'hls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'command': function('ale_linters#haskell#hls#GetCommand'),
|
||||
\ 'executable': {b -> ale#Var(b, 'haskell_hls_executable')},
|
||||
\ 'project_root': function('ale_linters#haskell#hls#GetProjectRoot'),
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'haskell_hls_config')},
|
||||
\})
|
23
sources_non_forked/ale/ale_linters/haskell/stack_build.vim
Normal file
23
sources_non_forked/ale/ale_linters/haskell/stack_build.vim
Normal file
@ -0,0 +1,23 @@
|
||||
" 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',
|
||||
\ 'aliases': ['stack-build'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': function('ale#handlers#haskell#GetStackExecutable'),
|
||||
\ 'command': function('ale_linters#haskell#stack_build#GetCommand'),
|
||||
\ 'lint_file': 1,
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
21
sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim
Normal file
21
sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim
Normal file
@ -0,0 +1,21 @@
|
||||
" 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': function('ale#handlers#haskell#GetStackExecutable'),
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#haskell#stack_ghc#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
Reference in New Issue
Block a user