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: antew - https://github.com/antew
2 " Description: elm-language-server integration for elm (diagnostics, formatting, and more)
4 call ale#Set('elm_ls_executable', 'elm-language-server')
5 call ale#Set('elm_ls_use_global', get(g:, 'ale_use_global_executables', 1))
7 " elm-language-server will search for local and global binaries, if empty
8 call ale#Set('elm_ls_elm_path', '')
9 call ale#Set('elm_ls_elm_format_path', '')
10 call ale#Set('elm_ls_elm_test_path', '')
11 call ale#Set('elm_ls_elm_analyse_trigger', 'change')
13 function! ale_linters#elm#ls#GetProjectRoot(buffer) abort
14 let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
16 return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : ''
19 function! ale_linters#elm#ls#GetInitializationOptions(buffer) abort
21 \ 'elmPath': ale#Var(a:buffer, 'elm_ls_elm_path'),
22 \ 'elmFormatPath': ale#Var(a:buffer, 'elm_ls_elm_format_path'),
23 \ 'elmTestPath': ale#Var(a:buffer, 'elm_ls_elm_test_path'),
24 \ 'elmAnalyseTrigger': ale#Var(a:buffer, 'elm_ls_elm_analyse_trigger'),
28 call ale#linter#Define('elm', {
30 \ 'aliases': ['elm_ls'],
32 \ 'executable': {b -> ale#path#FindExecutable(b, 'elm_ls', [
33 \ 'node_modules/.bin/elm-language-server',
34 \ 'node_modules/.bin/elm-lsp',
37 \ 'command': '%e --stdio',
38 \ 'project_root': function('ale_linters#elm#ls#GetProjectRoot'),
40 \ 'initialization_options': function('ale_linters#elm#ls#GetInitializationOptions')