mirror of
https://github.com/dense-analysis/ale
synced 2025-02-17 04:36:56 +00:00
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:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
|
||||||
for l:root_file in l:serach_root_files
|
for l:root_file in l:serach_root_files
|
||||||
if filereadable(l:path . l:root_file)
|
if filereadable(l:path . '/' . l:root_file)
|
||||||
return l:path
|
" Add on / so fnamemodify(..., ':h') below keeps the path.
|
||||||
|
return l:path . '/'
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
|
@ -30,3 +30,13 @@ Execute(Should accept configuration settings):
|
|||||||
AssertLSPConfig {}
|
AssertLSPConfig {}
|
||||||
let b:ale_haskell_hls_config = {'haskell': {'maxCompletions': 250}}
|
let b:ale_haskell_hls_config = {'haskell': {'maxCompletions': 250}}
|
||||||
AssertLSPConfig {'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
Block a user