From bd4da116eeb2352ce6a97e82c651fc4a65559dac Mon Sep 17 00:00:00 2001 From: Alvin Chan Date: Wed, 13 Jun 2018 17:35:52 -0700 Subject: [PATCH] Add TSServer support for JavaScript files --- ale_linters/javascript/tsserver.vim | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 ale_linters/javascript/tsserver.vim diff --git a/ale_linters/javascript/tsserver.vim b/ale_linters/javascript/tsserver.vim new file mode 100644 index 00000000..62dded10 --- /dev/null +++ b/ale_linters/javascript/tsserver.vim @@ -0,0 +1,26 @@ +" Author: Chaucerbao, w0rp +" Description: tsserver integration for ALE + +call ale#Set('javascript_tsserver_executable', 'tsserver') +call ale#Set('javascript_tsserver_config_path', '') +call ale#Set('javascript_tsserver_use_global', get(g:, 'ale_use_global_executables', 0)) + +" These functions need to be defined just to comply with the API for LSP. +function! ale_linters#javascript#tsserver#GetProjectRoot(buffer) abort + return '' +endfunction + +function! ale_linters#javascript#tsserver#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'javascript_tsserver', [ + \ 'node_modules/.bin/tsserver', + \]) +endfunction + +call ale#linter#Define('javascript', { +\ 'name': 'tsserver', +\ 'lsp': 'tsserver', +\ 'executable_callback': 'ale_linters#javascript#tsserver#GetExecutable', +\ 'command_callback': 'ale_linters#javascript#tsserver#GetExecutable', +\ 'project_root_callback': 'ale_linters#javascript#tsserver#GetProjectRoot', +\ 'language': '', +\})