2018-04-05 19:09:41 +00:00
|
|
|
" Author: pylipp (www.github.com/pylipp)
|
|
|
|
" Description: qmlfmt for QML files
|
|
|
|
|
2018-08-02 22:44:12 +00:00
|
|
|
call ale#Set('qml_qmlfmt_executable', 'qmlfmt')
|
2018-04-05 19:09:41 +00:00
|
|
|
|
|
|
|
" 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+): (.+)$'
|
|
|
|
|
2018-08-02 22:44:12 +00:00
|
|
|
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',
|
|
|
|
\}")
|
2018-04-05 19:09:41 +00:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
call ale#linter#Define('qml', {
|
|
|
|
\ 'name': 'qmlfmt',
|
|
|
|
\ 'output_stream': 'stderr',
|
2019-02-22 18:05:04 +00:00
|
|
|
\ 'executable': {b -> ale#Var(b, 'qml_qmlfmt_executable')},
|
2018-08-02 22:44:12 +00:00
|
|
|
\ 'command': '%e -e',
|
2018-04-05 19:09:41 +00:00
|
|
|
\ 'callback': 'ale_linters#qml#qmlfmt#Handle',
|
|
|
|
\})
|