summaryrefslogtreecommitdiff
path: root/ale_linters/elm
diff options
context:
space:
mode:
authorAntew <antewcode@gmail.com>2019-03-21 00:55:05 -0400
committerAntew <antewcode@gmail.com>2019-03-21 02:55:49 -0400
commit8ec96154000031e59d96092efe1ee9fd104ffcd0 (patch)
tree3ff8cb134323c0bfd160e09b362c8c6e29905160 /ale_linters/elm
parent80ef7ea2d0b22f0d8de7387a3d5bf6e9e5b72e9d (diff)
downloadale-8ec96154000031e59d96092efe1ee9fd104ffcd0.zip
Add support for elm-lsp
Diffstat (limited to 'ale_linters/elm')
-rw-r--r--ale_linters/elm/elm_lsp.vim22
1 files changed, 22 insertions, 0 deletions
diff --git a/ale_linters/elm/elm_lsp.vim b/ale_linters/elm/elm_lsp.vim
new file mode 100644
index 00000000..2259286f
--- /dev/null
+++ b/ale_linters/elm/elm_lsp.vim
@@ -0,0 +1,22 @@
+" 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'
+\})