mirror of
https://github.com/dense-analysis/ale.git
synced 2026-05-04 04:45:46 +08:00
b1b027d5e6
* Add support for PerlNavigator * fixup! Add support for PerlNavigator * fixup! fixup! Add support for PerlNavigator * fixup! fixup! fixup! Add support for PerlNavigator --------- Co-authored-by: cos <cos>
25 lines
833 B
VimL
25 lines
833 B
VimL
" Author: rymdbar <https://rymdbar.x20.se/>
|
|
|
|
function! ale#handlers#perl#GetProjectRoot(buffer) abort
|
|
" Makefile.PL, https://perldoc.perl.org/ExtUtils::MakeMaker
|
|
" Build.PL, https://metacpan.org/pod/Module::Build
|
|
" dist.ini, https://metacpan.org/pod/Dist::Zilla
|
|
let l:potential_roots = [ 'Makefile.PL', 'Build.PL', 'dist.ini' ]
|
|
|
|
for l:root in l:potential_roots
|
|
let l:project_root = ale#path#FindNearestFile(a:buffer, l:root)
|
|
|
|
if !empty(l:project_root)
|
|
return fnamemodify(l:project_root . '/', ':p:h:h')
|
|
endif
|
|
endfor
|
|
|
|
let l:project_root = ale#path#FindNearestFileOrDirectory(a:buffer, '.git')
|
|
|
|
if !empty(l:project_root)
|
|
return fnamemodify(l:project_root . '/', ':p:h:h')
|
|
endif
|
|
|
|
return fnamemodify(expand('#' . a:buffer . ':p:h'), ':p:h')
|
|
endfunction
|