mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 20:54:26 +08:00
Merge pull request #3310 from pbrisbin/master
Add dhall-format as a Fixer
This commit is contained in:
@@ -375,6 +375,11 @@ let s:default_registry = {
|
|||||||
\ 'suggested_filetypes': ['html', 'htmldjango'],
|
\ 'suggested_filetypes': ['html', 'htmldjango'],
|
||||||
\ 'description': 'Fix HTML files with html-beautify.',
|
\ '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.
|
" 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`!!
|
* `dartanalyzer`!!
|
||||||
* `dartfmt`!!
|
* `dartfmt`!!
|
||||||
* `language_server`
|
* `language_server`
|
||||||
|
* Dhall
|
||||||
|
* `dhall-format`
|
||||||
* Dockerfile
|
* Dockerfile
|
||||||
* `dockerfile_lint`
|
* `dockerfile_lint`
|
||||||
* `hadolint`
|
* `hadolint`
|
||||||
|
|||||||
@@ -128,6 +128,8 @@ formatting.
|
|||||||
* [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) :floppy_disk:
|
* [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)
|
* [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt)
|
||||||
* [language_server](https://github.com/natebosch/dart_language_server)
|
* [language_server](https://github.com/natebosch/dart_language_server)
|
||||||
|
* Dhall
|
||||||
|
* [dhall-format](https://github.com/dhall-lang/dhall-lang)
|
||||||
* Dockerfile
|
* Dockerfile
|
||||||
* [dockerfile_lint](https://github.com/projectatomic/dockerfile_lint)
|
* [dockerfile_lint](https://github.com/projectatomic/dockerfile_lint)
|
||||||
* [hadolint](https://github.com/hadolint/hadolint)
|
* [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 New Issue
Block a user