diff options
author | andys8 <andys8@users.noreply.github.com> | 2019-06-21 20:07:23 +0200 |
---|---|---|
committer | andys8 <andys8@users.noreply.github.com> | 2019-06-21 20:10:23 +0200 |
commit | 0843efc7a5010cd1aa0875a0254b466db9f7fc4a (patch) | |
tree | 0009906d810a95ff21bc529b10d8e00624287acd /ale_linters/elm | |
parent | 65ba4b85ec3011cccb9ea7135183e7fc8d7a0d69 (diff) | |
download | ale-0843efc7a5010cd1aa0875a0254b466db9f7fc4a.zip |
Update elm-ls
* elm_lsp is now elm_ls
* The binary published by @elm-tooling is elm-language-server
Updates tests, docs and adds more options to the plugin.
Diffstat (limited to 'ale_linters/elm')
-rw-r--r-- | ale_linters/elm/elm_ls.vim | 35 | ||||
-rw-r--r-- | ale_linters/elm/elm_lsp.vim | 22 |
2 files changed, 35 insertions, 22 deletions
diff --git a/ale_linters/elm/elm_ls.vim b/ale_linters/elm/elm_ls.vim new file mode 100644 index 00000000..4a373822 --- /dev/null +++ b/ale_linters/elm/elm_ls.vim @@ -0,0 +1,35 @@ +" 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)) +call ale#Set('elm_ls_elm_path', 'elm') +call ale#Set('elm_ls_elm_format_path', 'elm-format') +call ale#Set('elm_ls_elm_test_path', 'elm-test') + +function! elm_ls#GetRootDir(buffer) abort + let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json') + + return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : '' +endfunction + +function! elm_ls#GetOptions(buffer) abort + return { + \ 'runtime': 'node', + \ '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'), + \} +endfunction + +call ale#linter#Define('elm', { +\ 'name': 'elm_ls', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#node#FindExecutable(b, 'elm_ls', [ +\ 'node_modules/.bin/elm-language-server' +\ ])}, +\ 'command': '%e --stdio', +\ 'project_root': function('elm_ls#GetRootDir'), +\ 'language': 'elm', +\ 'initialization_options': function('elm_ls#GetOptions') +\}) diff --git a/ale_linters/elm/elm_lsp.vim b/ale_linters/elm/elm_lsp.vim deleted file mode 100644 index 2259286f..00000000 --- a/ale_linters/elm/elm_lsp.vim +++ /dev/null @@ -1,22 +0,0 @@ -" Author: antew - https://github.com/antew -" Description: LSP integration for elm, currently supports diagnostics (linting) - -call ale#Set('elm_lsp_executable', 'elm-lsp') -call ale#Set('elm_lsp_use_global', get(g:, 'ale_use_global_executables', 0)) - -function! elm_lsp#GetRootDir(buffer) abort - let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json') - - return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : '' -endfunction - -call ale#linter#Define('elm', { -\ 'name': 'elm_lsp', -\ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'elm_lsp', [ -\ 'node_modules/.bin/elm-lsp', -\ ])}, -\ 'command': '%e --stdio', -\ 'project_root': function('elm_lsp#GetRootDir'), -\ 'language': 'elm' -\}) |