All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: Arnold Chand <creativenull@outlook.com>
2 " Description: Volar Language Server integration for ALE adopted from
3 " nvim-lspconfig and volar/packages/shared/src/types.ts
5 call ale#Set('vue_volar_executable', 'vue-language-server')
6 call ale#Set('vue_volar_use_global', 1)
7 call ale#Set('vue_volar_init_options', {
8 \ 'typescript': { 'tsdk': '' },
11 function! ale_linters#vue#volar#GetProjectRoot(buffer) abort
12 let l:project_roots = [
22 for l:project_root in l:project_roots
23 let l:nearest_filepath = ale#path#FindNearestFile(a:buffer, l:project_root)
25 if !empty(l:nearest_filepath)
26 return fnamemodify(l:nearest_filepath, ':h')
33 function! ale_linters#vue#volar#GetInitializationOptions(buffer) abort
34 let l:tsserver_path = ale#path#FindNearestDirectory(a:buffer, 'node_modules/typescript/lib')
36 if l:tsserver_path is# ''
40 echom '[volar] Must have typescript installed in project, please install via `npm install -D typescript`.'
45 let l:init_options = ale#Var(a:buffer, 'vue_volar_init_options')
46 let l:init_options.typescript.tsdk = l:tsserver_path
51 call ale#linter#Define('vue', {
55 \ 'executable': {b -> ale#path#FindExecutable(b, 'vue_volar', ['node_modules/.bin/vue-language-server'])},
56 \ 'command': '%e --stdio',
57 \ 'project_root': function('ale_linters#vue#volar#GetProjectRoot'),
58 \ 'initialization_options': function('ale_linters#vue#volar#GetInitializationOptions'),