Close #2102 - Add support for the Angular language server

This commit is contained in:
w0rp
2021-03-14 21:10:05 +00:00
parent 80a48d01be
commit b45ee8ec6c
13 changed files with 230 additions and 48 deletions

View File

@@ -169,8 +169,21 @@ function! ale#assert#LinterNotExecuted() abort
let l:buffer = bufnr('')
let l:linter = s:GetLinter()
let l:executable = ale#linter#GetExecutable(l:buffer, l:linter)
let l:executed = 1
Assert empty(l:executable), "The linter will be executed when it shouldn't be"
if !empty(l:executable)
let l:command = ale#linter#GetCommand(l:buffer, l:linter)
if type(l:command) is v:t_list
let l:command = l:command[-1]
endif
let l:executed = !empty(l:command)
else
let l:executed = 0
endif
Assert !l:executed, "The linter will be executed when it shouldn't be"
endfunction
function! ale#assert#LSPOptions(expected_options) abort

View File

@@ -66,9 +66,17 @@ function! ale#definition#HandleLSPResponse(conn_id, response) abort
endif
for l:item in l:result
let l:filename = ale#path#FromURI(l:item.uri)
let l:line = l:item.range.start.line + 1
let l:column = l:item.range.start.character + 1
if has_key(l:item, 'targetUri')
" LocationLink items use targetUri
let l:filename = ale#path#FromURI(l:item.targetUri)
let l:line = l:item.targetRange.start.line + 1
let l:column = l:item.targetRange.start.character + 1
else
" LocationLink items use uri
let l:filename = ale#path#FromURI(l:item.uri)
let l:line = l:item.range.start.line + 1
let l:column = l:item.range.start.character + 1
endif
call ale#definition#UpdateTagStack()
call ale#util#Open(l:filename, l:line, l:column, l:options)

View File

@@ -294,14 +294,15 @@ function! s:StartLSP(options, address, executable, command) abort
call ale#lsp#MarkConnectionAsTsserver(l:conn_id)
endif
let l:cwd = ale#linter#GetCwd(l:buffer, l:linter)
let l:command = ale#command#FormatCommand(
\ l:buffer,
\ a:executable,
\ a:command,
\ 0,
\ v:false,
\ v:null,
\ [],
\ l:cwd,
\ ale#GetFilenameMappings(l:buffer, l:linter.name),
\)[1]
let l:command = ale#job#PrepareCommand(l:buffer, l:command)
let l:ready = ale#lsp#StartProgram(l:conn_id, a:executable, l:command)

View File

@@ -34,12 +34,11 @@ function! ale#test#RestoreDirectory() abort
unlet! g:dir
endfunction
" Change the filename for the current buffer using a relative path to
" the script without running autocmd commands.
" Get a filename for the current buffer using a relative path to the script.
"
" If a g:dir variable is set, it will be used as the path to the directory
" containing the test file.
function! ale#test#SetFilename(path) abort
function! ale#test#GetFilename(path) abort
let l:dir = get(g:, 'dir', '')
if empty(l:dir)
@@ -50,7 +49,17 @@ function! ale#test#SetFilename(path) abort
\ ? a:path
\ : l:dir . '/' . a:path
silent! noautocmd execute 'file ' . fnameescape(ale#path#Simplify(l:full_path))
return ale#path#Simplify(l:full_path)
endfunction
" Change the filename for the current buffer using a relative path to
" the script without running autocmd commands.
"
" If a g:dir variable is set, it will be used as the path to the directory
" containing the test file.
function! ale#test#SetFilename(path) abort
let l:full_path = ale#test#GetFilename(a:path)
silent! noautocmd execute 'file ' . fnameescape(l:full_path)
endfunction
function! s:RemoveModule(results) abort