1
0
Fork 0
mirror of synced 2024-11-14 13:08:59 -05:00
ultimate-vim/sources_non_forked/ale/ale_linters/elm/ls.vim

42 lines
1.5 KiB
VimL
Raw Normal View History

2019-08-22 11:36:17 -04:00
" Author: antew - https://github.com/antew
" Description: elm-language-server integration for elm (diagnostics, formatting, and more)
call ale#Set('elm_ls_executable', 'elm-language-server')
call ale#Set('elm_ls_use_global', get(g:, 'ale_use_global_executables', 1))
2019-11-16 10:28:42 -05:00
" elm-language-server will search for local and global binaries, if empty
call ale#Set('elm_ls_elm_path', '')
call ale#Set('elm_ls_elm_format_path', '')
call ale#Set('elm_ls_elm_test_path', '')
call ale#Set('elm_ls_elm_analyse_trigger', 'change')
2019-08-22 11:36:17 -04:00
2024-01-07 10:14:20 -05:00
function! ale_linters#elm#ls#GetProjectRoot(buffer) abort
2019-08-22 11:36:17 -04:00
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : ''
endfunction
2024-01-07 10:14:20 -05:00
function! ale_linters#elm#ls#GetOptions(buffer) abort
2019-08-22 11:36:17 -04:00
return {
\ 'elmPath': ale#Var(a:buffer, 'elm_ls_elm_path'),
\ 'elmFormatPath': ale#Var(a:buffer, 'elm_ls_elm_format_path'),
\ 'elmTestPath': ale#Var(a:buffer, 'elm_ls_elm_test_path'),
2019-11-16 10:28:42 -05:00
\ 'elmAnalyseTrigger': ale#Var(a:buffer, 'elm_ls_elm_analyse_trigger'),
2019-08-22 11:36:17 -04:00
\}
endfunction
call ale#linter#Define('elm', {
2024-01-07 10:14:20 -05:00
\ 'name': 'ls',
\ 'aliases': ['elm_ls'],
2019-08-22 11:36:17 -04:00
\ 'lsp': 'stdio',
2021-05-31 16:30:26 -04:00
\ 'executable': {b -> ale#path#FindExecutable(b, 'elm_ls', [
2019-08-22 11:36:17 -04:00
\ 'node_modules/.bin/elm-language-server',
\ 'node_modules/.bin/elm-lsp',
\ 'elm-lsp'
\ ])},
\ 'command': '%e --stdio',
2024-01-07 10:14:20 -05:00
\ 'project_root': function('ale_linters#elm#ls#GetProjectRoot'),
2019-08-22 11:36:17 -04:00
\ 'language': 'elm',
\ 'initialization_options': function('elm_ls#GetOptions')
\})