]> git.madduck.net Git - etc/vim.git/blob - ale_linters/yaml/ls.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / ale_linters / yaml / ls.vim
1 " Author: Jeffrey Lau - https://github.com/zoonfafer
2 " Description: YAML Language Server https://github.com/redhat-developer/yaml-language-server
3
4 call ale#Set('yaml_ls_executable', 'yaml-language-server')
5 call ale#Set('yaml_ls_use_global', get(g:, 'ale_use_global_executables', 0))
6 call ale#Set('yaml_ls_config', {})
7
8 function! ale_linters#yaml#ls#GetExecutable(buffer) abort
9     return ale#path#FindExecutable(a:buffer, 'yaml_ls', [
10     \   'node_modules/.bin/yaml-language-server',
11     \])
12 endfunction
13
14 function! ale_linters#yaml#ls#GetCommand(buffer) abort
15     let l:executable = ale_linters#yaml#ls#GetExecutable(a:buffer)
16
17     return ale#Escape(l:executable) . ' --stdio'
18 endfunction
19
20 " Just use the current file
21 function! ale_linters#yaml#ls#FindProjectRoot(buffer) abort
22     let l:project_file = expand('#' . a:buffer . ':p')
23
24     return fnamemodify(l:project_file, ':h')
25 endfunction
26
27 call ale#linter#Define('yaml', {
28 \   'name': 'yaml-language-server',
29 \   'aliases': ['yamlls'],
30 \   'lsp': 'stdio',
31 \   'executable': function('ale_linters#yaml#ls#GetExecutable'),
32 \   'command': function('ale_linters#yaml#ls#GetCommand'),
33 \   'project_root': function('ale_linters#yaml#ls#FindProjectRoot'),
34 \   'lsp_config': {b -> ale#Var(b, 'yaml_ls_config')},
35 \})