mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-10 06:21:53 +08:00
Merge remote-tracking branch 'AlexeiDrake/master' into bugfix/c-lsp-build-dir-settings
This commit is contained in:
@@ -215,6 +215,11 @@ let s:default_registry = {
|
|||||||
\ 'suggested_filetypes': ['haskell'],
|
\ 'suggested_filetypes': ['haskell'],
|
||||||
\ 'description': 'Fix Haskell files with brittany.',
|
\ 'description': 'Fix Haskell files with brittany.',
|
||||||
\ },
|
\ },
|
||||||
|
\ 'hindent': {
|
||||||
|
\ 'function': 'ale#fixers#hindent#Fix',
|
||||||
|
\ 'suggested_filetypes': ['haskell'],
|
||||||
|
\ 'description': 'Fix Haskell files with hindent.',
|
||||||
|
\ },
|
||||||
\ 'hlint': {
|
\ 'hlint': {
|
||||||
\ 'function': 'ale#fixers#hlint#Fix',
|
\ 'function': 'ale#fixers#hlint#Fix',
|
||||||
\ 'suggested_filetypes': ['haskell'],
|
\ 'suggested_filetypes': ['haskell'],
|
||||||
|
|||||||
20
autoload/ale/fixers/hindent.vim
Normal file
20
autoload/ale/fixers/hindent.vim
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
" Author: AlexeiDrake <drake.alexei@gmail.com>
|
||||||
|
" Description: Integration of hindent formatting with ALE.
|
||||||
|
"
|
||||||
|
call ale#Set('haskell_hindent_executable', 'hindent')
|
||||||
|
|
||||||
|
function! ale#fixers#hindent#GetExecutable(buffer) abort
|
||||||
|
let l:executable = ale#Var(a:buffer, 'haskell_hindent_executable')
|
||||||
|
|
||||||
|
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hindent')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale#fixers#hindent#Fix(buffer) abort
|
||||||
|
let l:executable = ale#fixers#hindent#GetExecutable(a:buffer)
|
||||||
|
|
||||||
|
return {
|
||||||
|
\ 'command': l:executable
|
||||||
|
\ . ' %t',
|
||||||
|
\ 'read_temporary_file': 1,
|
||||||
|
\}
|
||||||
|
endfunction
|
||||||
@@ -12,6 +12,7 @@ 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*
|
floskell *ale-haskell-floskell*
|
||||||
|
|
||||||
@@ -22,6 +23,7 @@ g:ale_haskell_floskell_executable *g:ale_haskell_floskell_executable*
|
|||||||
|
|
||||||
This variable can be changed to use a different executable for floskell.
|
This variable can be changed to use a different executable for floskell.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
ghc *ale-haskell-ghc*
|
ghc *ale-haskell-ghc*
|
||||||
|
|
||||||
@@ -32,6 +34,7 @@ g:ale_haskell_ghc_options *g:ale_haskell_ghc_options*
|
|||||||
|
|
||||||
This variable can be changed to modify flags given to ghc.
|
This variable can be changed to modify flags given to ghc.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
ghc-mod *ale-haskell-ghc-mod*
|
ghc-mod *ale-haskell-ghc-mod*
|
||||||
|
|
||||||
@@ -42,6 +45,7 @@ g:ale_haskell_ghc_mod_executable *g:ale_haskell_ghc_mod_executable*
|
|||||||
|
|
||||||
This variable can be changed to use a different executable for ghc-mod.
|
This variable can be changed to use a different executable for ghc-mod.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
cabal-ghc *ale-haskell-cabal-ghc*
|
cabal-ghc *ale-haskell-cabal-ghc*
|
||||||
|
|
||||||
@@ -53,6 +57,7 @@ g:ale_haskell_cabal_ghc_options *g:ale_haskell_cabal_ghc_options*
|
|||||||
This variable can be changed to modify flags given to ghc through cabal
|
This variable can be changed to modify flags given to ghc through cabal
|
||||||
exec.
|
exec.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
hdevtools *ale-haskell-hdevtools*
|
hdevtools *ale-haskell-hdevtools*
|
||||||
|
|
||||||
@@ -87,6 +92,18 @@ g:ale_haskell_hfmt_executable *g:ale_haskell_hfmt_executable*
|
|||||||
|
|
||||||
This variable can be changed to use a different executable for hfmt.
|
This variable can be changed to use a different executable for hfmt.
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
hindent *ale-haskell-hindent*
|
||||||
|
|
||||||
|
g:ale_haskell_hindent_executable *g:ale_haskell_hindent_executable*
|
||||||
|
*b:ale_haskell_hindent_executable*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'hindent'`
|
||||||
|
|
||||||
|
This variable can be changed to use a different executable for hindent.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
hlint *ale-haskell-hlint*
|
hlint *ale-haskell-hlint*
|
||||||
|
|
||||||
@@ -106,6 +123,7 @@ g:ale_haskell_hlint_options g:ale_haskell_hlint_options
|
|||||||
This variable can be used to pass extra options to the underlying hlint
|
This variable can be used to pass extra options to the underlying hlint
|
||||||
executable.
|
executable.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
stack-build *ale-haskell-stack-build*
|
stack-build *ale-haskell-stack-build*
|
||||||
|
|
||||||
@@ -117,6 +135,7 @@ g:ale_haskell_stack_build_options *g:ale_haskell_stack_build_options*
|
|||||||
We default to using `'--fast'`. Since Stack generates binaries, your
|
We default to using `'--fast'`. Since Stack generates binaries, your
|
||||||
programs will be slower unless you separately rebuild them outside of ALE.
|
programs will be slower unless you separately rebuild them outside of ALE.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
stack-ghc *ale-haskell-stack-ghc*
|
stack-ghc *ale-haskell-stack-ghc*
|
||||||
|
|
||||||
@@ -128,6 +147,7 @@ g:ale_haskell_stack_ghc_options *g:ale_haskell_stack_ghc_options*
|
|||||||
This variable can be changed to modify flags given to ghc through `stack
|
This variable can be changed to modify flags given to ghc through `stack
|
||||||
ghc`
|
ghc`
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
stylish-haskell *ale-haskell-stylish-haskell*
|
stylish-haskell *ale-haskell-stylish-haskell*
|
||||||
|
|
||||||
@@ -139,6 +159,7 @@ g:ale_haskell_stylish_haskell_executable
|
|||||||
|
|
||||||
This variable can be changed to use a different executable for stylish-haskell.
|
This variable can be changed to use a different executable for stylish-haskell.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
hie *ale-haskell-hie*
|
hie *ale-haskell-hie*
|
||||||
|
|
||||||
@@ -150,5 +171,6 @@ g:ale_haskell_hie_executable *g:ale_haskell_hie_executable*
|
|||||||
This variable can be changed to use a different executable for the haskell
|
This variable can be changed to use a different executable for the haskell
|
||||||
ide engine. i.e. `'hie-wrapper'`
|
ide engine. i.e. `'hie-wrapper'`
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||||
|
|||||||
@@ -183,6 +183,7 @@ Notes:
|
|||||||
* `hdevtools`
|
* `hdevtools`
|
||||||
* `hfmt`
|
* `hfmt`
|
||||||
* `hie`
|
* `hie`
|
||||||
|
* `hindent`
|
||||||
* `hlint`
|
* `hlint`
|
||||||
* `stack-build`!!
|
* `stack-build`!!
|
||||||
* `stack-ghc`
|
* `stack-ghc`
|
||||||
|
|||||||
@@ -2119,6 +2119,7 @@ documented in additional help files.
|
|||||||
cabal-ghc.............................|ale-haskell-cabal-ghc|
|
cabal-ghc.............................|ale-haskell-cabal-ghc|
|
||||||
hdevtools.............................|ale-haskell-hdevtools|
|
hdevtools.............................|ale-haskell-hdevtools|
|
||||||
hfmt..................................|ale-haskell-hfmt|
|
hfmt..................................|ale-haskell-hfmt|
|
||||||
|
hindent...............................|ale-haskell-hindent|
|
||||||
hlint.................................|ale-haskell-hlint|
|
hlint.................................|ale-haskell-hlint|
|
||||||
stack-build...........................|ale-haskell-stack-build|
|
stack-build...........................|ale-haskell-stack-build|
|
||||||
stack-ghc.............................|ale-haskell-stack-ghc|
|
stack-ghc.............................|ale-haskell-stack-ghc|
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ formatting.
|
|||||||
* [hdevtools](https://hackage.haskell.org/package/hdevtools)
|
* [hdevtools](https://hackage.haskell.org/package/hdevtools)
|
||||||
* [hfmt](https://github.com/danstiner/hfmt)
|
* [hfmt](https://github.com/danstiner/hfmt)
|
||||||
* [hie](https://github.com/haskell/haskell-ide-engine)
|
* [hie](https://github.com/haskell/haskell-ide-engine)
|
||||||
|
* [hindent](https://hackage.haskell.org/package/hindent)
|
||||||
* [hlint](https://hackage.haskell.org/package/hlint)
|
* [hlint](https://hackage.haskell.org/package/hlint)
|
||||||
* [stack-build](https://haskellstack.org/) :floppy_disk:
|
* [stack-build](https://haskellstack.org/) :floppy_disk:
|
||||||
* [stack-ghc](https://haskellstack.org/)
|
* [stack-ghc](https://haskellstack.org/)
|
||||||
|
|||||||
18
test/fixers/test_hindent_fixer_callback.vader
Normal file
18
test/fixers/test_hindent_fixer_callback.vader
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
Before:
|
||||||
|
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||||
|
|
||||||
|
After:
|
||||||
|
Restore
|
||||||
|
|
||||||
|
call ale#test#RestoreDirectory()
|
||||||
|
|
||||||
|
Execute(The hindent callback should return the correct default values):
|
||||||
|
call ale#test#SetFilename('../haskell_files/testfile.hs')
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ {
|
||||||
|
\ 'read_temporary_file': 1,
|
||||||
|
\ 'command': ale#Escape('hindent')
|
||||||
|
\ . ' %t',
|
||||||
|
\ },
|
||||||
|
\ ale#fixers#hindent#Fix(bufnr(''))
|
||||||
Reference in New Issue
Block a user