mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-06 01:47:47 +08:00
Add support for perl language server (#5003)
* Fix perl test case clean-up * Add support for perl language server Co-authored-by: cos <cos>
This commit is contained in:
@@ -12,3 +12,5 @@ Execute(Overriding the executable and command should work):
|
||||
let b:ale_perl_perl_options = '-w'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' -w %t'
|
||||
unlet b:ale_perl_perl_executable
|
||||
unlet b:ale_perl_perl_options
|
||||
|
||||
82
test/linter/test_perl_languageserver.vader
Normal file
82
test/linter/test_perl_languageserver.vader
Normal file
@@ -0,0 +1,82 @@
|
||||
" Author: rymdbar <https://rymdbar.x20.se/>
|
||||
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('perl', 'languageserver')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default Perl command callback should be correct):
|
||||
AssertLinter 'perl',
|
||||
\ ale#Escape('perl') . ' -MPerl::LanguageServer -ePerl::LanguageServer::run'
|
||||
|
||||
Execute(Overriding the executable should work):
|
||||
let b:ale_perl_perl_executable = 'plls'
|
||||
|
||||
AssertLinter 'plls', ale#Escape('plls') .
|
||||
\ ' -MPerl::LanguageServer -ePerl::LanguageServer::run'
|
||||
unlet b:ale_perl_perl_executable
|
||||
|
||||
Execute(The project root should be detected correctly in from build files):
|
||||
for mod in ['extutils-makemaker', 'module-build', 'dist-zilla']
|
||||
call ale#test#SetFilename('../test-files/perl/' . mod . '/subdir/empty.pl')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl/' . mod)
|
||||
endfor
|
||||
|
||||
Execute(The project root should be globally configurable):
|
||||
for mod in ['extutils-makemaker', 'module-build', 'dist-zilla']
|
||||
call ale#test#SetFilename('../test-files/perl/'. mod . '/subdir/empty.pl')
|
||||
" Configuring g:ale_root using a Dictionary works.
|
||||
let g:ale_root.languageserver =
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||
unlet g:ale_root.languageserver
|
||||
" As tracked by <https://github.com/dense-analysis/ale/issues/5002>, there
|
||||
" is a bug with g:ale_root.
|
||||
" While attempting to configure g:ale_root using a String might be a quite
|
||||
" limiting setup, it would be handy for debugging. However the test case is
|
||||
" missing here. It would unfortunately just fail.
|
||||
endfor
|
||||
|
||||
Execute(The project root should be per buffer configurable):
|
||||
for mod in ['extutils-makemaker', 'module-build', 'dist-zilla']
|
||||
call ale#test#SetFilename('../test-files/perl/'. mod . '/subdir/empty.pl')
|
||||
" Configuring b:ale_root using a String works.
|
||||
let b:ale_root = ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||
unlet b:ale_root
|
||||
|
||||
" Configuring b:ale_root using a Dictionary works.
|
||||
let b:ale_root = {
|
||||
\ 'languageserver': ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||
\ }
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||
unlet b:ale_root.languageserver
|
||||
endfor
|
||||
|
||||
Execute(The LSP values should be set correctly):
|
||||
|
||||
AssertLSPLanguage 'perl'
|
||||
|
||||
AssertLSPOptions {}
|
||||
|
||||
AssertLSPConfig {'perl': {'enable': 1}}
|
||||
|
||||
Execute(Should accept configuration settings):
|
||||
let b:ale_perl_languageserver_config = {
|
||||
\ 'perl': {
|
||||
\ 'perlInc': ['/usr/share/perl5/', '/usr/local/share/perl5/' ],
|
||||
\ 'fileFilter': [''],
|
||||
\ },
|
||||
\ }
|
||||
|
||||
AssertLSPConfig {
|
||||
\ 'perl': {
|
||||
\ 'perlInc': ['/usr/share/perl5/', '/usr/local/share/perl5/' ],
|
||||
\ 'fileFilter': [''],
|
||||
\ },
|
||||
\ }
|
||||
1
test/test-files/perl/dist-zilla/dist.ini
Normal file
1
test/test-files/perl/dist-zilla/dist.ini
Normal file
@@ -0,0 +1 @@
|
||||
# https://metacpan.org/pod/Dist::Zilla
|
||||
0
test/test-files/perl/dist-zilla/subdir/empty.pl
Normal file
0
test/test-files/perl/dist-zilla/subdir/empty.pl
Normal file
1
test/test-files/perl/extutils-makemaker/Makefile.PL
Normal file
1
test/test-files/perl/extutils-makemaker/Makefile.PL
Normal file
@@ -0,0 +1 @@
|
||||
# https://perldoc.perl.org/ExtUtils::MakeMaker
|
||||
1
test/test-files/perl/module-build/Build.PL
Normal file
1
test/test-files/perl/module-build/Build.PL
Normal file
@@ -0,0 +1 @@
|
||||
# https://metacpan.org/pod/Module::Build
|
||||
0
test/test-files/perl/module-build/subdir/empty.pl
Normal file
0
test/test-files/perl/module-build/subdir/empty.pl
Normal file
Reference in New Issue
Block a user