summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters')
-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'
+\})