All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: Luxed <devildead13@gmail.com>
2 " Description: A language server for Haskell
4 call ale#Set('haskell_hie_executable', 'hie')
6 function! ale_linters#haskell#hie#GetProjectRoot(buffer) abort
7 " Search for the stack file first
8 let l:project_file = ale#path#FindNearestFile(a:buffer, 'stack.yaml')
10 " If it's empty, search for the cabal file
11 if empty(l:project_file)
12 " Search all of the paths except for the root filesystem path.
14 \ ale#path#Upwards(expand('#' . a:buffer . ':p:h'))[:-2],
17 let l:project_file = globpath(l:paths, '*.cabal')
20 " If we still can't find one, use the current file.
21 if empty(l:project_file)
22 let l:project_file = expand('#' . a:buffer . ':p')
25 return fnamemodify(l:project_file, ':h')
28 function! ale_linters#haskell#hie#GetCommand(buffer) abort
29 let l:executable = ale#Var(a:buffer, 'haskell_hie_executable')
31 return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hie')
35 call ale#linter#Define('haskell', {
38 \ 'command': function('ale_linters#haskell#hie#GetCommand'),
39 \ 'executable': {b -> ale#Var(b, 'haskell_hie_executable')},
40 \ 'project_root': function('ale_linters#haskell#hie#GetProjectRoot'),