Skip to content

Commit

Permalink
Format djlint.vim according to formatting rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
vds2212 committed Mar 7, 2025
1 parent 1fd3b67 commit 037c04f
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions ale_linters/html/djlint.vim
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,35 @@ function! ale_linters#html#djlint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'html_djlint_options')

return ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '') . ' %s'
\ . (!empty(l:options) ? ' ' . l:options : '') . ' %s'
endfunction

function! ale_linters#html#djlint#Handle(buffer, lines)
function! ale_linters#html#djlint#Handle(buffer, lines) abort
let l:output = []
let l:pattern = '\v^([A-Z]\d+) (\d+):(\d+) (.*)$'
let l:i = 0

for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:i += 1
let l:item = {
\ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0,
\ 'vcol': 1,
\ 'text': l:match[4],
\ 'code': l:match[1],
\ 'type': 'W',
\}
\ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0,
\ 'vcol': 1,
\ 'text': l:match[4],
\ 'code': l:match[1],
\ 'type': 'W',
\}
call add(l:output, l:item)
endfor

return l:output
endfunction

call ale#linter#Define('html', {
\ 'name': 'djlint',
\ 'executable': function('ale_linters#html#djlint#GetExecutable'),
\ 'command': function('ale_linters#html#djlint#GetCommand'),
\ 'callback': 'ale_linters#html#djlint#Handle',
\})
\ 'name': 'djlint',
\ 'executable': function('ale_linters#html#djlint#GetExecutable'),
\ 'command': function('ale_linters#html#djlint#GetCommand'),
\ 'callback': 'ale_linters#html#djlint#Handle',
\})

" vim:ts=4:sw=4:et:

0 comments on commit 037c04f

Please sign in to comment.