summaryrefslogtreecommitdiff
path: root/ale_linters/vue
diff options
context:
space:
mode:
authorAlexander Olofsson <alexander.olofsson@liu.se>2018-07-05 14:04:20 +0200
committerAlexander Olofsson <alexander.olofsson@liu.se>2018-07-05 14:04:20 +0200
commitfd42e8e935e31ac7eef8db821302280d12e6cff0 (patch)
tree6bd868843411843b93fe936d80134991aad93b4d /ale_linters/vue
parentd49daeb816217014a50bdab9d61b22535e55b179 (diff)
downloadale-fd42e8e935e31ac7eef8db821302280d12e6cff0.zip
vue: Add the vls language server linter
Diffstat (limited to 'ale_linters/vue')
-rw-r--r--ale_linters/vue/vls.vim32
1 files changed, 32 insertions, 0 deletions
diff --git a/ale_linters/vue/vls.vim b/ale_linters/vue/vls.vim
new file mode 100644
index 00000000..0d4bf9f6
--- /dev/null
+++ b/ale_linters/vue/vls.vim
@@ -0,0 +1,32 @@
+" Author: Alexander Olofsson <alexander.olofsson@liu.se>
+" Description: Vue vls Language Server integration for ALE
+
+call ale#Set('vue_vls_executable', 'vls')
+call ale#Set('vue_vls_use_global', get(g:, 'ale_use_global_executables', 0))
+
+function! ale_linters#vue#vls#GetExecutable(buffer) abort
+ return ale#node#FindExecutable(a:buffer, 'vue_vls', [
+ \ 'node_modules/.bin/vls',
+ \])
+endfunction
+
+function! ale_linters#vue#vls#GetCommand(buffer) abort
+ let l:exe = ale#Escape(ale_linters#vue#vls#GetExecutable(a:buffer))
+
+ return l:exe . ' --stdio'
+endfunction
+
+function! ale_linters#vue#vls#GetProjectRoot(buffer) abort
+ let l:package_path = ale#path#FindNearestFile(a:buffer, 'package.json')
+
+ return !empty(l:package_path) ? fnamemodify(l:package_path, ':h') : ''
+endfunction
+
+call ale#linter#Define('vue', {
+\ 'name': 'vls',
+\ 'lsp': 'stdio',
+\ 'executable_callback': 'ale_linters#vue#vls#GetExecutable',
+\ 'command_callback': 'ale_linters#vue#vls#GetCommand',
+\ 'language': 'vue',
+\ 'project_root_callback': 'ale_linters#vue#vls#GetProjectRoot',
+\})