summaryrefslogtreecommitdiff
path: root/ale_linters/typescript/tsserver.vim
blob: 7a155bd97c153223774e0792ae3b88f988e13fc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
" Author: w0rp <devw0rp@gmail.com>
" Description: tsserver integration for ALE

call ale#Set('typescript_tsserver_executable', 'tsserver')
call ale#Set('typescript_tsserver_config_path', '')
call ale#Set('typescript_tsserver_use_global', 0)

" These functions need to be defined just to comply with the API for LSP.
function! ale_linters#typescript#tsserver#GetProjectRoot(buffer) abort
    return ''
endfunction

function! ale_linters#typescript#tsserver#GetLanguage(buffer) abort
    return ''
endfunction

function! ale_linters#typescript#tsserver#GetExecutable(buffer) abort
    return ale#node#FindExecutable(a:buffer, 'typescript_tsserver', [
    \   'node_modules/.bin/tsserver',
    \])
endfunction

call ale#linter#Define('typescript', {
\   'name': 'tsserver',
\   'lsp': 'tsserver',
\   'executable_callback': 'ale_linters#typescript#tsserver#GetExecutable',
\   'command_callback': 'ale_linters#typescript#tsserver#GetExecutable',
\   'project_root_callback': 'ale_linters#typescript#tsserver#GetProjectRoot',
\   'language_callback': 'ale_linters#typescript#tsserver#GetLanguage',
\})