Add dhall-format as a Fixer

https://github.com/dhall-lang/dhall-lang
This commit is contained in:
patrick brisbin 2020-08-25 08:57:35 -04:00
parent 3e2abe3f25
commit 447aea4af0
No known key found for this signature in database
GPG Key ID: 20299C6982D938FB
5 changed files with 43 additions and 0 deletions

View File

@ -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.

View 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

View File

@ -119,6 +119,8 @@ Notes:
* `dartanalyzer`!!
* `dartfmt`!!
* `language_server`
* Dhall
* `dhall-format`
* Dockerfile
* `dockerfile_lint`
* `hadolint`

View File

@ -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)

View 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'
\ }