Skip to content

Commit

Permalink
add basic djlint support
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEpic-dev committed Aug 29, 2022
1 parent 6996d1c commit be60869
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions autoload/ale/fix/registry.vim
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['dhall'],
\ 'description': 'Standard code formatter for the Dhall language and removing dead code',
\ },
\ 'djlint': {
\ 'function': 'ale#fixers#djlint#Fix',
\ 'suggested_filetypes': ['htmldjango'],
\ 'description': 'Fixer for Django templates, Jinja2, and others.',
\ },
\ 'dune': {
\ 'function': 'ale#fixers#dune#Fix',
\ 'suggested_filetypes': ['dune'],
Expand Down
14 changes: 14 additions & 0 deletions autoload/ale/fixers/djlint.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
call ale#Set('djlint_executable', 'djlint')
call ale#Set('djlint_options', '')

function! ale#fixers#djlint#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'djlint_executable')
let l:options = ale#Var(a:buffer, 'djlint_options')

return {
\ 'command': ale#Escape(l:executable)
\ . ' --reformat'
\ . (empty(l:options) ? '': ' ' . l:options)
\ . ' -',
\}
endfunction

0 comments on commit be60869

Please sign in to comment.