Merge remote-tracking branch 'AlexeiDrake/master' into bugfix/c-lsp-build-dir-settings

This commit is contained in:
w0rp 2019-08-18 18:28:58 +01:00
parent 91636cff06
commit 73812c3e41
No known key found for this signature in database
GPG Key ID: 0FC1ECAA8C81CD83
7 changed files with 68 additions and 0 deletions

View File

@ -215,6 +215,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['haskell'],
\ 'description': 'Fix Haskell files with brittany.',
\ },
\ 'hindent': {
\ 'function': 'ale#fixers#hindent#Fix',
\ 'suggested_filetypes': ['haskell'],
\ 'description': 'Fix Haskell files with hindent.',
\ },
\ 'hlint': {
\ 'function': 'ale#fixers#hlint#Fix',
\ 'suggested_filetypes': ['haskell'],

View 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

View File

@ -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.
===============================================================================
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.
===============================================================================
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.
===============================================================================
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.
===============================================================================
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
exec.
===============================================================================
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.
===============================================================================
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*
@ -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
executable.
===============================================================================
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
programs will be slower unless you separately rebuild them outside of ALE.
===============================================================================
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
ghc`
===============================================================================
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.
===============================================================================
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
ide engine. i.e. `'hie-wrapper'`
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -183,6 +183,7 @@ Notes:
* `hdevtools`
* `hfmt`
* `hie`
* `hindent`
* `hlint`
* `stack-build`!!
* `stack-ghc`

View File

@ -2119,6 +2119,7 @@ documented in additional help files.
cabal-ghc.............................|ale-haskell-cabal-ghc|
hdevtools.............................|ale-haskell-hdevtools|
hfmt..................................|ale-haskell-hfmt|
hindent...............................|ale-haskell-hindent|
hlint.................................|ale-haskell-hlint|
stack-build...........................|ale-haskell-stack-build|
stack-ghc.............................|ale-haskell-stack-ghc|

View File

@ -192,6 +192,7 @@ formatting.
* [hdevtools](https://hackage.haskell.org/package/hdevtools)
* [hfmt](https://github.com/danstiner/hfmt)
* [hie](https://github.com/haskell/haskell-ide-engine)
* [hindent](https://hackage.haskell.org/package/hindent)
* [hlint](https://hackage.haskell.org/package/hlint)
* [stack-build](https://haskellstack.org/) :floppy_disk:
* [stack-ghc](https://haskellstack.org/)

View 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(''))