forked from github-mirrors/ale
addressing missing docs + cleaning up older Dhall files
This commit is contained in:
parent
b32954a46c
commit
ed47008710
|
@ -1,4 +1,4 @@
|
||||||
" Author: toastal <toastal@protonmail.com>
|
" Author: Pat Brisbin <pbrisbin@gmail.com>, toastal <toastal@protonmail.com>
|
||||||
" Description: Functions for working with Dhall’s executable
|
" Description: Functions for working with Dhall’s executable
|
||||||
|
|
||||||
call ale#Set('dhall_executable', 'dhall')
|
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', '')
|
call ale#Set('dhall_options', '')
|
||||||
|
|
||||||
function! ale#dhall#GetExecutable(buffer) abort
|
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
|
endfunction
|
||||||
|
|
||||||
function! ale#dhall#GetExecutableWithOptions(buffer) abort
|
function! ale#dhall#GetExecutableWithOptions(buffer) abort
|
||||||
|
|
|
@ -390,11 +390,6 @@ 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.
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
" 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
|
|
|
@ -1,6 +1,6 @@
|
||||||
" Author: toastal <toastal@protonmail.com>
|
" Author: toastal <toastal@protonmail.com>
|
||||||
" Description: Dhall’s built-in formatter
|
" Description: Dhall’s built-in formatter
|
||||||
|
"
|
||||||
function! ale#fixers#dhall_format#Fix(buffer) abort
|
function! ale#fixers#dhall_format#Fix(buffer) abort
|
||||||
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
|
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
|
||||||
let l:command = l:executable
|
let l:command = l:executable
|
||||||
|
|
|
@ -121,6 +121,8 @@ Notes:
|
||||||
* `language_server`
|
* `language_server`
|
||||||
* Dhall
|
* Dhall
|
||||||
* `dhall-format`
|
* `dhall-format`
|
||||||
|
* `dhall-freeze`
|
||||||
|
* `dhall-lint`
|
||||||
* Dockerfile
|
* Dockerfile
|
||||||
* `dockerfile_lint`
|
* `dockerfile_lint`
|
||||||
* `hadolint`
|
* `hadolint`
|
||||||
|
|
|
@ -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'
|
|
||||||
\ }
|
|
|
@ -6,22 +6,19 @@ Before:
|
||||||
let g:ale_dhall_executable = 'odd-dhall'
|
let g:ale_dhall_executable = 'odd-dhall'
|
||||||
let g:ale_dhall_options = '--ascii'
|
let g:ale_dhall_options = '--ascii'
|
||||||
|
|
||||||
call ale#test#SetDirectory('/testplugin/test/dhall')
|
call ale#assert#SetUpFixerTest('dhall-format', 'dhall-format')
|
||||||
|
|
||||||
After:
|
After:
|
||||||
Restore
|
call ale#assert#TearDownFixerTest()
|
||||||
|
|
||||||
call ale#test#RestoreDirectory()
|
|
||||||
|
|
||||||
Execute(The dhall-format callback should return the correct options):
|
Execute(The dhall-format callback should return the correct options):
|
||||||
call ale#test#SetFilename('../dhall_files/testfile.dhall')
|
call ale#test#SetFilename('../dhall_files/testfile.dhall')
|
||||||
|
|
||||||
AssertEqual
|
AssertFixer
|
||||||
\ {
|
\ {
|
||||||
\ 'command': ale#Escape('odd-dhall')
|
\ 'command': ale#Escape('odd-dhall')
|
||||||
\ . ' --ascii'
|
\ . ' --ascii'
|
||||||
\ . ' format'
|
\ . ' format'
|
||||||
\ . ' --inplace %t',
|
\ . ' --inplace %t',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ },
|
\ }
|
||||||
\ ale#fixers#dhall_format#Fix(bufnr(''))
|
|
||||||
|
|
|
@ -7,17 +7,13 @@ Before:
|
||||||
let g:ale_dhall_options = '--ascii'
|
let g:ale_dhall_options = '--ascii'
|
||||||
let g:ale_dhall_freeze_options = '--all'
|
let g:ale_dhall_freeze_options = '--all'
|
||||||
|
|
||||||
call ale#test#SetDirectory('/testplugin/test/dhall')
|
call ale#assert#SetUpFixerTest('dhall-freeze', 'dhall-freeze')
|
||||||
|
|
||||||
After:
|
After:
|
||||||
Restore
|
call ale#assert#TearDownFixerTest()
|
||||||
|
|
||||||
call ale#test#RestoreDirectory()
|
|
||||||
|
|
||||||
Execute(The dhall-freeze callback should return the correct options):
|
Execute(The dhall-freeze callback should return the correct options):
|
||||||
call ale#test#SetFilename('../dhall_files/testfile.dhall')
|
AssertFixer
|
||||||
|
|
||||||
AssertEqual
|
|
||||||
\ {
|
\ {
|
||||||
\ 'command': ale#Escape('odd-dhall')
|
\ 'command': ale#Escape('odd-dhall')
|
||||||
\ . ' --ascii'
|
\ . ' --ascii'
|
||||||
|
@ -25,5 +21,4 @@ Execute(The dhall-freeze callback should return the correct options):
|
||||||
\ . ' --all'
|
\ . ' --all'
|
||||||
\ . ' --inplace %t',
|
\ . ' --inplace %t',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ },
|
\ }
|
||||||
\ ale#fixers#dhall_freeze#Freeze(bufnr(''))
|
|
||||||
|
|
|
@ -6,22 +6,17 @@ Before:
|
||||||
let g:ale_dhall_executable = 'odd-dhall'
|
let g:ale_dhall_executable = 'odd-dhall'
|
||||||
let g:ale_dhall_options = '--ascii'
|
let g:ale_dhall_options = '--ascii'
|
||||||
|
|
||||||
call ale#test#SetDirectory('/testplugin/test/dhall')
|
call ale#assert#SetUpFixerTest('dhall-lint', 'dhall-lint')
|
||||||
|
|
||||||
After:
|
After:
|
||||||
Restore
|
call ale#assert#TearDownFixerTest()
|
||||||
|
|
||||||
call ale#test#RestoreDirectory()
|
|
||||||
|
|
||||||
Execute(The dhall-lint callback should return the correct options):
|
Execute(The dhall-lint callback should return the correct options):
|
||||||
call ale#test#SetFilename('../dhall_files/testfile.dhall')
|
AssertFixer
|
||||||
|
|
||||||
AssertEqual
|
|
||||||
\ {
|
\ {
|
||||||
\ 'command': ale#Escape('odd-dhall')
|
\ 'command': ale#Escape('odd-dhall')
|
||||||
\ . ' --ascii'
|
\ . ' --ascii'
|
||||||
\ . ' lint'
|
\ . ' lint'
|
||||||
\ . ' --inplace %t',
|
\ . ' --inplace %t',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ },
|
\ }
|
||||||
\ ale#fixers#dhall_lint#Fix(bufnr(''))
|
|
||||||
|
|
Loading…
Reference in New Issue