mirror of https://github.com/dense-analysis/ale
Fix execution of the Angular language server for HTML files
This commit is contained in:
parent
ac0495df6e
commit
11a90ad0ff
|
@ -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',
|
||||
\])
|
||||
|
||||
return ale#node#Executable(a:buffer, l:executable)
|
||||
if !filereadable(l:script)
|
||||
return ''
|
||||
endif
|
||||
|
||||
return ale#Escape('node') . ' ' . ale#Escape(l:script)
|
||||
\ . ' --ngProbeLocations ' . ale#Escape(l:language_service_dir)
|
||||
\ . ' --tsProbeLocations ' . ale#Escape(l:typescript_dir)
|
||||
\ . ' --stdio'
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in New Issue