parent
3e2abe3f25
commit
447aea4af0
5 changed files with 43 additions and 0 deletions
|
@ -375,6 +375,11 @@ let s:default_registry = {
|
|||
\ 'suggested_filetypes': ['html', 'htmldjango'],
|
||||
\ 'description': 'Fix HTML files with html-beautify.',
|
||||
\ },
|
||||
\ 'dhall': {
|
||||
\ 'function': 'ale#fixers#dhall#Fix',
|
||||
\ 'suggested_filetypes': ['dhall'],
|
||||
\ 'description': 'Fix Dhall files with dhall-format.',
|
||||
\ },
|
||||
\}
|
||||
|
||||
" Reset the function registry to the default entries.
|
||||
|
|
23
autoload/ale/fixers/dhall.vim
Normal file
23
autoload/ale/fixers/dhall.vim
Normal file
|
@ -0,0 +1,23 @@
|
|||
" Author: Pat Brisbin <pbrisbin@gmail.com>
|
||||
" Description: Integration of dhall-format with ALE.
|
||||
|
||||
call ale#Set('dhall_format_executable', 'dhall')
|
||||
|
||||
function! ale#fixers#dhall#GetExecutable(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'dhall_format_executable')
|
||||
|
||||
" Dhall is written in Haskell and commonly installed with Stack
|
||||
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'dhall')
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#dhall#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#dhall#GetExecutable(a:buffer)
|
||||
|
||||
return {
|
||||
\ 'command': l:executable
|
||||
\ . ' format'
|
||||
\ . ' --inplace'
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
|
@ -119,6 +119,8 @@ Notes:
|
|||
* `dartanalyzer`!!
|
||||
* `dartfmt`!!
|
||||
* `language_server`
|
||||
* Dhall
|
||||
* `dhall-format`
|
||||
* Dockerfile
|
||||
* `dockerfile_lint`
|
||||
* `hadolint`
|
||||
|
|
|
@ -128,6 +128,8 @@ formatting.
|
|||
* [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) :floppy_disk:
|
||||
* [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt)
|
||||
* [language_server](https://github.com/natebosch/dart_language_server)
|
||||
* Dhall
|
||||
* [dhall-format](https://github.com/dhall-lang/dhall-lang)
|
||||
* Dockerfile
|
||||
* [dockerfile_lint](https://github.com/projectatomic/dockerfile_lint)
|
||||
* [hadolint](https://github.com/hadolint/hadolint)
|
||||
|
|
11
test/fixers/test_dhall_fixer_callback.vader
Normal file
11
test/fixers/test_dhall_fixer_callback.vader
Normal file
|
@ -0,0 +1,11 @@
|
|||
Before:
|
||||
call ale#assert#SetUpFixerTest('dhall', 'dhall')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertFixer
|
||||
\ { 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape('dhall') . ' format --inplace %t'
|
||||
\ }
|
Reference in a new issue