Skip to content

Commit

Permalink
added implementation for elm
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudParan committed Oct 27, 2020
1 parent a3082cc commit 8af0e1c
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion autoload/neomake/makers/ft/elm.vim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
" vim: ts=4 sw=4 et

function! neomake#makers#ft#elm#EnabledMakers() abort
return ['elmMake']
return ['elmMake', 'elm']
endfunction

function! neomake#makers#ft#elm#elmMake() abort
Expand Down Expand Up @@ -51,3 +51,34 @@ function! neomake#makers#ft#elm#ElmMakeProcessOutput(context) abort
endfor
return errors
endfunction

function! neomake#makers#ft#elm#elm() abort
return {
\ 'exe': 'elm',
\ 'args': ['make', '--report=json', '--output=' . g:neomake#compat#dev_null],
\ 'process_output': function('neomake#makers#ft#elm#ElmProcessOutput')
\ }
endfunction

function! neomake#makers#ft#elm#ElmProcessOutput(context) abort
" output will be a List, containing either:
" 1) A success message
" 2) A string holding a JSON array for both warnings and errors

let ret = []
for errors in neomake#compat#json_decode(a:context.output)['errors']
for err in errors['problems']
let curr = {
\ 'text': err['title'],
\ 'lnum': err['region']['start']['line'],
\ 'col': err['region']['start']['column'],
\ 'length': err['region']['end']['column'] - err['region']['start']['column'],
\ 'filename': errors['path'],
\ 'type': 'E',
\ }
call add(ret, curr)
endfor
endfor

return ret
endfunction

0 comments on commit 8af0e1c

Please sign in to comment.