summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorJasper Woudenberg <github@jasperwoudenberg.com>2017-06-25 18:12:40 +0200
committerw0rp <w0rp@users.noreply.github.com>2017-06-25 17:12:40 +0100
commitc2f69b77501d098fdd973c332d08e18d8e30abd0 (patch)
treef6337ce751a3e88514dc812b54c9f15f675dc71f /ale_linters
parent93473a410139f4c094ae491e690bb22b40648214 (diff)
downloadale-c2f69b77501d098fdd973c332d08e18d8e30abd0.zip
Improve elm linter (#637)
* Improve elm linter Some types of errors do not return nice JSON. Show them on the first line instead of showing nothing. * Remove unnecessary properties from elm linter * Add a vader test for elm-make linter * Test non-JSON elm-make errors are shown
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/elm/make.vim13
1 files changed, 12 insertions, 1 deletions
diff --git a/ale_linters/elm/make.vim b/ale_linters/elm/make.vim
index 08bc24b5..da81287c 100644
--- a/ale_linters/elm/make.vim
+++ b/ale_linters/elm/make.vim
@@ -5,6 +5,7 @@ function! ale_linters#elm#make#Handle(buffer, lines) abort
let l:output = []
let l:is_windows = has('win32')
let l:temp_dir = l:is_windows ? $TMP : $TMPDIR
+ let l:unparsed_lines = []
for l:line in a:lines
if l:line[0] ==# '['
let l:errors = json_decode(l:line)
@@ -20,7 +21,6 @@ function! ale_linters#elm#make#Handle(buffer, lines) abort
if l:file_is_buffer
call add(l:output, {
- \ 'bufnr': a:buffer,
\ 'lnum': l:error.region.start.line,
\ 'col': l:error.region.start.column,
\ 'type': (l:error.type ==? 'error') ? 'E' : 'W',
@@ -29,9 +29,20 @@ function! ale_linters#elm#make#Handle(buffer, lines) abort
\})
endif
endfor
+ elseif l:line !=# 'Successfully generated /dev/null'
+ call add(l:unparsed_lines, l:line)
endif
endfor
+ if len(l:unparsed_lines) > 0
+ call add(l:output, {
+ \ 'lnum': 1,
+ \ 'type': 'E',
+ \ 'text': l:unparsed_lines[0],
+ \ 'detail': join(l:unparsed_lines, "\n")
+ \})
+ endif
+
return l:output
endfunction