From ed47008710a2295ff3bf2d2e6372ee29cdbe6c39 Mon Sep 17 00:00:00 2001 From: toastal Date: Mon, 14 Sep 2020 09:20:53 +0700 Subject: [PATCH] addressing missing docs + cleaning up older Dhall files --- autoload/ale/dhall.vim | 7 ++++-- autoload/ale/fix/registry.vim | 5 ---- autoload/ale/fixers/dhall.vim | 23 ------------------- autoload/ale/fixers/dhall_format.vim | 2 +- doc/ale-supported-languages-and-tools.txt | 2 ++ test/fixers/test_dhall_fixer_callback.vader | 11 --------- .../test_dhall_format_fixer_callback.vader | 11 ++++----- .../test_dhall_freeze_fixer_callback.vader | 13 ++++------- .../test_dhall_lint_fixer_callback.vader | 13 ++++------- 9 files changed, 20 insertions(+), 67 deletions(-) delete mode 100644 autoload/ale/fixers/dhall.vim delete mode 100644 test/fixers/test_dhall_fixer_callback.vader diff --git a/autoload/ale/dhall.vim b/autoload/ale/dhall.vim index 6e57c4a7..cc54418f 100644 --- a/autoload/ale/dhall.vim +++ b/autoload/ale/dhall.vim @@ -1,4 +1,4 @@ -" Author: toastal +" Author: Pat Brisbin , toastal " Description: Functions for working with Dhall’s executable call ale#Set('dhall_executable', 'dhall') @@ -6,7 +6,10 @@ call ale#Set('dhall_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('dhall_options', '') function! ale#dhall#GetExecutable(buffer) abort - return ale#Escape(ale#Var(a:buffer, 'dhall_executable')) + let l:executable = ale#Var(a:buffer, 'dhall_executable') + + " Dhall is written in Haskell and commonly installed with Stack + return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'dhall') endfunction function! ale#dhall#GetExecutableWithOptions(buffer) abort diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index 0a729cf9..218a0f95 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -390,11 +390,6 @@ 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. diff --git a/autoload/ale/fixers/dhall.vim b/autoload/ale/fixers/dhall.vim deleted file mode 100644 index 18f6006c..00000000 --- a/autoload/ale/fixers/dhall.vim +++ /dev/null @@ -1,23 +0,0 @@ -" Author: Pat Brisbin -" 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 diff --git a/autoload/ale/fixers/dhall_format.vim b/autoload/ale/fixers/dhall_format.vim index 214af2c8..d4021983 100644 --- a/autoload/ale/fixers/dhall_format.vim +++ b/autoload/ale/fixers/dhall_format.vim @@ -1,6 +1,6 @@ " Author: toastal " Description: Dhall’s built-in formatter - +" function! ale#fixers#dhall_format#Fix(buffer) abort let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer) let l:command = l:executable diff --git a/doc/ale-supported-languages-and-tools.txt b/doc/ale-supported-languages-and-tools.txt index c6bcf421..7579566a 100644 --- a/doc/ale-supported-languages-and-tools.txt +++ b/doc/ale-supported-languages-and-tools.txt @@ -121,6 +121,8 @@ Notes: * `language_server` * Dhall * `dhall-format` + * `dhall-freeze` + * `dhall-lint` * Dockerfile * `dockerfile_lint` * `hadolint` diff --git a/test/fixers/test_dhall_fixer_callback.vader b/test/fixers/test_dhall_fixer_callback.vader deleted file mode 100644 index f27880b7..00000000 --- a/test/fixers/test_dhall_fixer_callback.vader +++ /dev/null @@ -1,11 +0,0 @@ -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' - \ } diff --git a/test/fixers/test_dhall_format_fixer_callback.vader b/test/fixers/test_dhall_format_fixer_callback.vader index 02873473..9bc17f7e 100644 --- a/test/fixers/test_dhall_format_fixer_callback.vader +++ b/test/fixers/test_dhall_format_fixer_callback.vader @@ -6,22 +6,19 @@ Before: let g:ale_dhall_executable = 'odd-dhall' let g:ale_dhall_options = '--ascii' - call ale#test#SetDirectory('/testplugin/test/dhall') + call ale#assert#SetUpFixerTest('dhall-format', 'dhall-format') After: - Restore - - call ale#test#RestoreDirectory() + call ale#assert#TearDownFixerTest() Execute(The dhall-format callback should return the correct options): call ale#test#SetFilename('../dhall_files/testfile.dhall') - AssertEqual + AssertFixer \ { \ 'command': ale#Escape('odd-dhall') \ . ' --ascii' \ . ' format' \ . ' --inplace %t', \ 'read_temporary_file': 1, - \ }, - \ ale#fixers#dhall_format#Fix(bufnr('')) + \ } diff --git a/test/fixers/test_dhall_freeze_fixer_callback.vader b/test/fixers/test_dhall_freeze_fixer_callback.vader index 6e9650eb..c8f820bb 100644 --- a/test/fixers/test_dhall_freeze_fixer_callback.vader +++ b/test/fixers/test_dhall_freeze_fixer_callback.vader @@ -7,17 +7,13 @@ Before: let g:ale_dhall_options = '--ascii' let g:ale_dhall_freeze_options = '--all' - call ale#test#SetDirectory('/testplugin/test/dhall') + call ale#assert#SetUpFixerTest('dhall-freeze', 'dhall-freeze') After: - Restore - - call ale#test#RestoreDirectory() + call ale#assert#TearDownFixerTest() Execute(The dhall-freeze callback should return the correct options): - call ale#test#SetFilename('../dhall_files/testfile.dhall') - - AssertEqual + AssertFixer \ { \ 'command': ale#Escape('odd-dhall') \ . ' --ascii' @@ -25,5 +21,4 @@ Execute(The dhall-freeze callback should return the correct options): \ . ' --all' \ . ' --inplace %t', \ 'read_temporary_file': 1, - \ }, - \ ale#fixers#dhall_freeze#Freeze(bufnr('')) + \ } diff --git a/test/fixers/test_dhall_lint_fixer_callback.vader b/test/fixers/test_dhall_lint_fixer_callback.vader index c60b7a73..82229363 100644 --- a/test/fixers/test_dhall_lint_fixer_callback.vader +++ b/test/fixers/test_dhall_lint_fixer_callback.vader @@ -6,22 +6,17 @@ Before: let g:ale_dhall_executable = 'odd-dhall' let g:ale_dhall_options = '--ascii' - call ale#test#SetDirectory('/testplugin/test/dhall') + call ale#assert#SetUpFixerTest('dhall-lint', 'dhall-lint') After: - Restore - - call ale#test#RestoreDirectory() + call ale#assert#TearDownFixerTest() Execute(The dhall-lint callback should return the correct options): - call ale#test#SetFilename('../dhall_files/testfile.dhall') - - AssertEqual + AssertFixer \ { \ 'command': ale#Escape('odd-dhall') \ . ' --ascii' \ . ' lint' \ . ' --inplace %t', \ 'read_temporary_file': 1, - \ }, - \ ale#fixers#dhall_lint#Fix(bufnr('')) + \ }