Fix #2276 - Replace a potentially infinite loop for hie
This commit is contained in:
parent
0b9c0c2200
commit
2885c57e3e
@ -9,26 +9,20 @@ function! ale_linters#haskell#hie#GetProjectRoot(buffer) abort
|
|||||||
|
|
||||||
" If it's empty, search for the cabal file
|
" If it's empty, search for the cabal file
|
||||||
if empty(l:project_file)
|
if empty(l:project_file)
|
||||||
let l:cabal_file = fnamemodify(bufname(a:buffer), ':p:h')
|
" Search all of the paths except for the root filesystem path.
|
||||||
let l:paths = ''
|
let l:paths = join(
|
||||||
|
\ ale#path#Upwards(expand('#' . a:buffer . ':p:h'))[:-2],
|
||||||
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')
|
let l:project_file = globpath(l:paths, '*.cabal')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Either extract the project directory or take the current working
|
" If we still can't find one, use the current file.
|
||||||
" directory
|
if empty(l:project_file)
|
||||||
if !empty(l:project_file)
|
let l:project_file = expand('#' . a:buffer . ':p')
|
||||||
let l:project_file = fnamemodify(l:project_file, ':h')
|
|
||||||
else
|
|
||||||
let l:project_file = expand('#' . a:buffer . ':p:h')
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return l:project_file
|
return fnamemodify(l:project_file, ':h')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#haskell#hie#GetCommand(buffer) abort
|
function! ale_linters#haskell#hie#GetCommand(buffer) abort
|
||||||
|
Loading…
x
Reference in New Issue
Block a user