Add floskell for Haskell formatting
This commit is contained in:
parent
495bce32e9
commit
99361b2ca9
@ -190,6 +190,11 @@ let s:default_registry = {
|
|||||||
\ 'suggested_filetypes': ['hack'],
|
\ 'suggested_filetypes': ['hack'],
|
||||||
\ 'description': 'Fix Hack files with hackfmt.',
|
\ 'description': 'Fix Hack files with hackfmt.',
|
||||||
\ },
|
\ },
|
||||||
|
\ 'floskell': {
|
||||||
|
\ 'function': 'ale#fixers#floskell#Fix',
|
||||||
|
\ 'suggested_filetypes': ['haskell'],
|
||||||
|
\ 'description': 'Fix Haskell files with floskell.',
|
||||||
|
\ },
|
||||||
\ 'hfmt': {
|
\ 'hfmt': {
|
||||||
\ 'function': 'ale#fixers#hfmt#Fix',
|
\ 'function': 'ale#fixers#hfmt#Fix',
|
||||||
\ 'suggested_filetypes': ['haskell'],
|
\ 'suggested_filetypes': ['haskell'],
|
||||||
|
20
autoload/ale/fixers/floskell.vim
Normal file
20
autoload/ale/fixers/floskell.vim
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
" Author: robertjlooby <robertjlooby@gmail.com>
|
||||||
|
" Description: Integration of floskell with ALE.
|
||||||
|
|
||||||
|
call ale#Set('haskell_floskell_executable', 'floskell')
|
||||||
|
|
||||||
|
function! ale#fixers#floskell#GetExecutable(buffer) abort
|
||||||
|
let l:executable = ale#Var(a:buffer, 'haskell_floskell_executable')
|
||||||
|
|
||||||
|
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'floskell')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale#fixers#floskell#Fix(buffer) abort
|
||||||
|
let l:executable = ale#fixers#floskell#GetExecutable(a:buffer)
|
||||||
|
|
||||||
|
return {
|
||||||
|
\ 'command': l:executable
|
||||||
|
\ . ' %t',
|
||||||
|
\ 'read_temporary_file': 1,
|
||||||
|
\}
|
||||||
|
endfunction
|
@ -12,6 +12,16 @@ g:ale_haskell_brittany_executable *g:ale_haskell_brittany_executable*
|
|||||||
|
|
||||||
This variable can be changed to use a different executable for brittany.
|
This variable can be changed to use a different executable for brittany.
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
floskell *ale-haskell-floskell*
|
||||||
|
|
||||||
|
g:ale_haskell_floskell_executable *g:ale_haskell_floskell_executable*
|
||||||
|
*b:ale_haskell_floskell_executable*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'floskell'`
|
||||||
|
|
||||||
|
This variable can be changed to use a different executable for floskell.
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
ghc *ale-haskell-ghc*
|
ghc *ale-haskell-ghc*
|
||||||
|
|
||||||
|
@ -175,6 +175,7 @@ Notes:
|
|||||||
* Haskell
|
* Haskell
|
||||||
* `brittany`
|
* `brittany`
|
||||||
* `cabal-ghc`
|
* `cabal-ghc`
|
||||||
|
* `floskell`
|
||||||
* `ghc`
|
* `ghc`
|
||||||
* `ghc-mod`
|
* `ghc-mod`
|
||||||
* `hdevtools`
|
* `hdevtools`
|
||||||
|
@ -1958,6 +1958,7 @@ documented in additional help files.
|
|||||||
ember-template-lint...................|ale-handlebars-embertemplatelint|
|
ember-template-lint...................|ale-handlebars-embertemplatelint|
|
||||||
haskell.................................|ale-haskell-options|
|
haskell.................................|ale-haskell-options|
|
||||||
brittany..............................|ale-haskell-brittany|
|
brittany..............................|ale-haskell-brittany|
|
||||||
|
floskell..............................|ale-haskell-floskell|
|
||||||
ghc...................................|ale-haskell-ghc|
|
ghc...................................|ale-haskell-ghc|
|
||||||
ghc-mod...............................|ale-haskell-ghc-mod|
|
ghc-mod...............................|ale-haskell-ghc-mod|
|
||||||
cabal-ghc.............................|ale-haskell-cabal-ghc|
|
cabal-ghc.............................|ale-haskell-cabal-ghc|
|
||||||
|
@ -184,6 +184,7 @@ formatting.
|
|||||||
* Haskell
|
* Haskell
|
||||||
* [brittany](https://github.com/lspitzner/brittany)
|
* [brittany](https://github.com/lspitzner/brittany)
|
||||||
* [cabal-ghc](https://www.haskell.org/cabal/)
|
* [cabal-ghc](https://www.haskell.org/cabal/)
|
||||||
|
* [floskell](https://github.com/ennocramer/floskell)
|
||||||
* [ghc](https://www.haskell.org/ghc/)
|
* [ghc](https://www.haskell.org/ghc/)
|
||||||
* [ghc-mod](https://github.com/DanielG/ghc-mod)
|
* [ghc-mod](https://github.com/DanielG/ghc-mod)
|
||||||
* [hdevtools](https://hackage.haskell.org/package/hdevtools)
|
* [hdevtools](https://hackage.haskell.org/package/hdevtools)
|
||||||
|
23
test/fixers/test_floskell_fixer_callback.vader
Normal file
23
test/fixers/test_floskell_fixer_callback.vader
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
Before:
|
||||||
|
Save g:ale_haskell_floskell_executable
|
||||||
|
|
||||||
|
" Use an invalid global executable, so we don't match it.
|
||||||
|
let g:ale_haskell_floskell_executable = 'xxxinvalid'
|
||||||
|
|
||||||
|
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||||
|
|
||||||
|
After:
|
||||||
|
Restore
|
||||||
|
|
||||||
|
call ale#test#RestoreDirectory()
|
||||||
|
|
||||||
|
Execute(The floskell callback should return the correct default values):
|
||||||
|
call ale#test#SetFilename('../haskell_files/testfile.hs')
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ {
|
||||||
|
\ 'read_temporary_file': 1,
|
||||||
|
\ 'command': ale#Escape('xxxinvalid')
|
||||||
|
\ . ' %t',
|
||||||
|
\ },
|
||||||
|
\ ale#fixers#floskell#Fix(bufnr(''))
|
Loading…
Reference in New Issue
Block a user