mirror of https://github.com/dense-analysis/ale
Close #4541 - Fix Haskell project root detection
We weren't joining and returning paths correctly for detecting project roots for Haskell projects, and now we are. Co-authored-by: Rodrigo Mesquita <rodrigo.m.mesquita@gmail.com>
This commit is contained in:
parent
dca621b675
commit
bd9fc580a1
|
@ -16,8 +16,9 @@ function! ale_linters#haskell#hls#FindRootFile(buffer) abort
|
|||
|
||||
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
|
||||
if filereadable(l:path . '/' . l:root_file)
|
||||
" Add on / so fnamemodify(..., ':h') below keeps the path.
|
||||
return l:path . '/'
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
|
|
@ -30,3 +30,13 @@ Execute(Should accept configuration settings):
|
|||
AssertLSPConfig {}
|
||||
let b:ale_haskell_hls_config = {'haskell': {'maxCompletions': 250}}
|
||||
AssertLSPConfig {'haskell': {'maxCompletions': 250}}
|
||||
|
||||
Execute(We should detect the root with cabal.project files, preferred over *.cabal files):
|
||||
call ale#test#SetFilename('../test-files/haskell/haskell-packages-project/package-a/src/folder/dummy.hs')
|
||||
|
||||
AssertLSPProject ale#test#GetFilename('../test-files/haskell/haskell-packages-project')
|
||||
|
||||
Execute(We should a project root with *.cabal files):
|
||||
call ale#test#SetFilename('../test-files/haskell/haskell-simple-package/package-a/src/folder/dummy.hs')
|
||||
|
||||
AssertLSPProject ale#test#GetFilename('../test-files/haskell/haskell-simple-package/package-a')
|
||||
|
|
Loading…
Reference in New Issue