From c2f69b77501d098fdd973c332d08e18d8e30abd0 Mon Sep 17 00:00:00 2001 From: Jasper Woudenberg Date: Sun, 25 Jun 2017 18:12:40 +0200 Subject: 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 --- ale_linters/elm/make.vim | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'ale_linters') 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 -- cgit v1.2.3