diff options
author | w0rp <w0rp@users.noreply.github.com> | 2019-10-29 17:37:18 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-29 17:37:18 +0000 |
commit | 2d9380d75c5c27a3241925d24ab3be8977a43207 (patch) | |
tree | f045fd328b49f32a588949f2b4f2b2d73662251f /autoload | |
parent | e259dd525f94576ff40f7ee6a0605229e37506e3 (diff) | |
parent | f89b49a014bb3f5cf0c6820e8b3f4347292b4a06 (diff) | |
download | ale-2d9380d75c5c27a3241925d24ab3be8977a43207.zip |
Merge pull request #2690 from iclanzan/purty
Add purty fixer for PureScript
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fix/registry.vim | 5 | ||||
-rw-r--r-- | autoload/ale/fixers/purty.vim | 22 |
2 files changed, 27 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index 4dfe767e..5ec27a10 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -235,6 +235,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['haskell'], \ 'description': 'Refactor Haskell files with stylish-haskell.', \ }, +\ 'purty': { +\ 'function': 'ale#fixers#purty#Fix', +\ 'suggested_filetypes': ['purescript'], +\ 'description': 'Format PureScript files with purty.', +\ }, \ 'ocamlformat': { \ 'function': 'ale#fixers#ocamlformat#Fix', \ 'suggested_filetypes': ['ocaml'], diff --git a/autoload/ale/fixers/purty.vim b/autoload/ale/fixers/purty.vim new file mode 100644 index 00000000..46d2cacd --- /dev/null +++ b/autoload/ale/fixers/purty.vim @@ -0,0 +1,22 @@ +" Author: iclanzan <sorin@iclanzan.com> +" Description: Integration of purty with ALE. + +call ale#Set('purescript_purty_executable', 'purty') + +function! ale#fixers#purty#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'purescript_purty_executable') + + return ale#Escape(l:executable) +endfunction + +function! ale#fixers#purty#Fix(buffer) abort + let l:executable = ale#fixers#purty#GetExecutable(a:buffer) + + return { + \ 'command': l:executable + \ . ' --write' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction + |