summaryrefslogtreecommitdiff
path: root/ale_linters/javascript/tsserver.vim
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2018-06-17 22:14:12 +0100
committerGitHub <noreply@github.com>2018-06-17 22:14:12 +0100
commit43ce8d761035e221b735b73597b482b9f2764b42 (patch)
tree0396b0d719f3f9d6981bbb76253557ecad3ca869 /ale_linters/javascript/tsserver.vim
parent24fe1953110455f7f3305db2a8e5abc2aa6821af (diff)
parentbd4da116eeb2352ce6a97e82c651fc4a65559dac (diff)
downloadale-43ce8d761035e221b735b73597b482b9f2764b42.zip
Merge pull request #1653 from chaucerbao/feature/js-tsserver-support
Add TSServer support for JavaScript files
Diffstat (limited to 'ale_linters/javascript/tsserver.vim')
-rw-r--r--ale_linters/javascript/tsserver.vim26
1 files changed, 26 insertions, 0 deletions
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 <devw0rp@gmail.com>
+" 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': '',
+\})