From 212dcd0bf753f08c0127a26a71b673c734b45c02 Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Thu, 5 Sep 2019 19:35:38 +0300 Subject: init commit, extracted vim config from i3rice --- .vim/autoload/neomake/makers/ft/elm.vim | 53 +++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .vim/autoload/neomake/makers/ft/elm.vim (limited to '.vim/autoload/neomake/makers/ft/elm.vim') diff --git a/.vim/autoload/neomake/makers/ft/elm.vim b/.vim/autoload/neomake/makers/ft/elm.vim new file mode 100644 index 0000000..fe1d2f6 --- /dev/null +++ b/.vim/autoload/neomake/makers/ft/elm.vim @@ -0,0 +1,53 @@ +" vim: ts=4 sw=4 et + +function! neomake#makers#ft#elm#EnabledMakers() abort + return ['elmMake'] +endfunction + +function! neomake#makers#ft#elm#elmMake() abort + return { + \ 'exe': 'elm-make', + \ 'args': ['--report=json', '--output=' . g:neomake#compat#dev_null], + \ 'process_output': function('neomake#makers#ft#elm#ElmMakeProcessOutput') + \ } +endfunction + +function! neomake#makers#ft#elm#ElmMakeProcessOutput(context) abort + let errors = [] + " output will be a List, containing either: + " 1) A success message + " 2) A string holding a JSON array for both warnings and errors + + for line in a:context.output + if line[0] ==# '[' + let decoded = neomake#compat#json_decode(line) + for item in decoded + if get(item, 'type', '') ==# 'warning' + let code = 'W' + else + let code = 'E' + endif + + let compiler_error = item['tag'] + let message = item['overview'] + let filename = item['file'] + let region_start = item['region']['start'] + let region_end = item['region']['end'] + let row = region_start['line'] + let col = region_start['column'] + let length = region_end['column'] - region_start['column'] + + let error = { + \ 'text': compiler_error . ' : ' . message, + \ 'type': code, + \ 'lnum': row, + \ 'col': col, + \ 'length': length, + \ 'filename': filename, + \ } + call add(errors, error) + endfor + endif + endfor + return errors +endfunction -- cgit v1.2.3