Add support for PerlNavigator (#5028)

* 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>
This commit is contained in:
rymdbar
2026-04-10 16:19:14 +02:00
committed by GitHub
parent 674a8cced8
commit b1b027d5e6
8 changed files with 170 additions and 26 deletions
+1 -24
View File
@@ -5,29 +5,6 @@
call ale#Set('perl_perl_executable', 'perl')
" Please note that perl_perl_options does not exist here.
function! ale_linters#perl#languageserver#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
call ale#Set('perl_languageserver_config', {})
function! s:get_lsp_config(buffer) abort
@@ -45,5 +22,5 @@ call ale#linter#Define('perl', {
\ 'executable': {b -> ale#Var(b, 'perl_perl_executable')},
\ 'command': '%e -MPerl::LanguageServer -ePerl::LanguageServer::run',
\ 'lsp_config': {b -> s:get_lsp_config(b)},
\ 'project_root': function('ale_linters#perl#languageserver#GetProjectRoot'),
\ 'project_root': function('ale#handlers#perl#GetProjectRoot'),
\ })
+15
View File
@@ -0,0 +1,15 @@
" Author: rymdbar <https://rymdbar.x20.se/>
" Description: Perl Navigator Language Server
" See: https://github.com/bscan/PerlNavigator
call ale#Set('perl_perlnavigator_config', {})
call ale#Set('perl_perlnavigator_executable', 'perlnavigator')
call ale#linter#Define('perl', {
\ 'name': 'perlnavigator',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'perl_perlnavigator_executable')},
\ 'command': '%e --stdio',
\ 'lsp_config': {b -> ale#Var(b, 'perl_perlnavigator_config')},
\ 'project_root': function('ale#handlers#perl#GetProjectRoot'),
\ })