summaryrefslogtreecommitdiff
path: root/ale_linters/vue/vls.vim
blob: 009effd0a9e8079def408bb52a4a9c307be5acec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
" 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#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',
\   'aliases': ['vuels'],
\   'lsp': 'stdio',
\   'executable': {b -> ale#path#FindExecutable(b, 'vue_vls', [
\       'node_modules/.bin/vls',
\   ])},
\   'command': '%e --stdio',
\   'language': 'vue',
\   'project_root': function('ale_linters#vue#vls#GetProjectRoot'),
\})