X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/0ee596c5c5e11fc79598407eaf22f83d279f7e9e..5a4872f466ebd76ddd532bdf2798554421c53df4:/.vim/bundle/ale/ale_linters/qml/qmlfmt.vim diff --git a/.vim/bundle/ale/ale_linters/qml/qmlfmt.vim b/.vim/bundle/ale/ale_linters/qml/qmlfmt.vim new file mode 100644 index 00000000..11cc9413 --- /dev/null +++ b/.vim/bundle/ale/ale_linters/qml/qmlfmt.vim @@ -0,0 +1,25 @@ +" Author: pylipp (www.github.com/pylipp) +" Description: qmlfmt for QML files + +call ale#Set('qml_qmlfmt_executable', 'qmlfmt') + +" Find lines like +" Error:11:1: Expected token `}' +function! ale_linters#qml#qmlfmt#Handle(buffer, lines) abort + let l:pattern = '\v^(Error|Warning):(\d+):(\d+): (.+)$' + + return map(ale#util#GetMatches(a:lines, l:pattern), "{ + \ 'lnum': v:val[2] + 0, + \ 'col': v:val[3] + 0, + \ 'text': v:val[4], + \ 'type': v:val[1] is# 'Warning' ? 'W' : 'E', + \}") +endfunction + +call ale#linter#Define('qml', { +\ 'name': 'qmlfmt', +\ 'output_stream': 'stderr', +\ 'executable': {b -> ale#Var(b, 'qml_qmlfmt_executable')}, +\ 'command': '%e -e', +\ 'callback': 'ale_linters#qml#qmlfmt#Handle', +\})