diff options
-rw-r--r-- | ale_linters/html/angular.vim | 16 | ||||
-rw-r--r-- | test/linter/test_angular.vader | 18 |
2 files changed, 11 insertions, 23 deletions
diff --git a/ale_linters/html/angular.vim b/ale_linters/html/angular.vim index 17c0a751..4f368fb4 100644 --- a/ale_linters/html/angular.vim +++ b/ale_linters/html/angular.vim @@ -11,10 +11,7 @@ function! ale_linters#html#angular#GetProjectRoot(buffer) abort endfunction function! ale_linters#html#angular#GetExecutable(buffer) abort - return ale#path#FindExecutable(a:buffer, 'html_angular', [ - \ 'node_modules/@angular/language-server/bin/ngserver', - \ 'node_modules/@angular/language-server/index.js', - \]) + return 'node' endfunction function! ale_linters#html#angular#GetCommand(buffer) abort @@ -34,9 +31,16 @@ function! ale_linters#html#angular#GetCommand(buffer) abort \ fnamemodify(l:language_service_dir, ':h:h') \ . '/typescript' \) - let l:executable = ale_linters#html#angular#GetExecutable(a:buffer) + let l:script = ale#path#FindExecutable(a:buffer, 'html_angular', [ + \ 'node_modules/@angular/language-server/bin/ngserver', + \ 'node_modules/@angular/language-server/index.js', + \]) + + if !filereadable(l:script) + return '' + endif - return ale#node#Executable(a:buffer, l:executable) + return ale#Escape('node') . ' ' . ale#Escape(l:script) \ . ' --ngProbeLocations ' . ale#Escape(l:language_service_dir) \ . ' --tsProbeLocations ' . ale#Escape(l:typescript_dir) \ . ' --stdio' diff --git a/test/linter/test_angular.vader b/test/linter/test_angular.vader index fe0749a1..2e407a00 100644 --- a/test/linter/test_angular.vader +++ b/test/linter/test_angular.vader @@ -22,23 +22,7 @@ Execute(The default command for Angular should be correct): AssertLSPLanguage 'html' AssertLSPProject ale#test#GetFilename('../test-files/angular') - AssertLinter g:paths.ngserver, ale#Escape(g:paths.ngserver) - \ . ' --ngProbeLocations ' . ale#Escape(g:paths.service) - \ . ' --tsProbeLocations ' . ale#Escape(g:paths.typescript) - \ . ' --stdio' - -Execute(It should be possible to use the global ngserver): - let b:ale_html_angular_use_global = 1 - - call ale#test#SetFilename('../test-files/angular/test.html') - let g:paths = { - \ 'service': ale#test#GetFilename('../test-files/angular/node_modules/@angular/language-service'), - \ 'typescript': ale#test#GetFilename('../test-files/angular/node_modules/typescript'), - \} - - AssertLSPLanguage 'html' - AssertLSPProject ale#test#GetFilename('../test-files/angular') - AssertLinter 'ngserver', ale#Escape('ngserver') + AssertLinter 'node', ale#Escape('node') . ' ' . ale#Escape(g:paths.ngserver) \ . ' --ngProbeLocations ' . ale#Escape(g:paths.service) \ . ' --tsProbeLocations ' . ale#Escape(g:paths.typescript) \ . ' --stdio' |