1
0
Fork 0
mirror of synced 2024-11-27 11:15:35 -05:00
ultimate-vim/sources_non_forked/ale/ale_linters/yaml/ls.vim

36 lines
1.2 KiB
VimL
Raw Permalink Normal View History

2022-08-08 09:45:34 -04:00
" Author: Jeffrey Lau - https://github.com/zoonfafer
" Description: YAML Language Server https://github.com/redhat-developer/yaml-language-server
call ale#Set('yaml_ls_executable', 'yaml-language-server')
call ale#Set('yaml_ls_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('yaml_ls_config', {})
function! ale_linters#yaml#ls#GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer, 'yaml_ls', [
\ 'node_modules/.bin/yaml-language-server',
\])
endfunction
function! ale_linters#yaml#ls#GetCommand(buffer) abort
let l:executable = ale_linters#yaml#ls#GetExecutable(a:buffer)
return ale#Escape(l:executable) . ' --stdio'
endfunction
" Just use the current file
function! ale_linters#yaml#ls#FindProjectRoot(buffer) abort
let l:project_file = expand('#' . a:buffer . ':p')
return fnamemodify(l:project_file, ':h')
endfunction
call ale#linter#Define('yaml', {
\ 'name': 'yaml-language-server',
2024-01-07 10:14:20 -05:00
\ 'aliases': ['yamlls'],
2022-08-08 09:45:34 -04:00
\ 'lsp': 'stdio',
\ 'executable': function('ale_linters#yaml#ls#GetExecutable'),
\ 'command': function('ale_linters#yaml#ls#GetCommand'),
\ 'project_root': function('ale_linters#yaml#ls#FindProjectRoot'),
\ 'lsp_config': {b -> ale#Var(b, 'yaml_ls_config')},
\})