forked from github-mirrors/ale
`purs-tidy` for PureScript (#3863)
* purs-tidy * update email address for toastal
This commit is contained in:
parent
a793db7399
commit
775d121d46
|
@ -301,6 +301,11 @@ let s:default_registry = {
|
|||
\ 'suggested_filetypes': ['haskell'],
|
||||
\ 'description': 'Refactor Haskell files with stylish-haskell.',
|
||||
\ },
|
||||
\ 'purs-tidy': {
|
||||
\ 'function': 'ale#fixers#purs_tidy#Fix',
|
||||
\ 'suggested_filetypes': ['purescript'],
|
||||
\ 'description': 'Format PureScript files with purs-tidy.',
|
||||
\ },
|
||||
\ 'purty': {
|
||||
\ 'function': 'ale#fixers#purty#Fix',
|
||||
\ 'suggested_filetypes': ['purescript'],
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
" Author: toastal <toastal@protonmail.com>
|
||||
" Author: toastal <toastal@posteo.net>
|
||||
" Description: Dhall’s built-in formatter
|
||||
"
|
||||
function! ale#fixers#dhall_format#Fix(buffer) abort
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
" Author: toastal <toastal@protonmail.com>
|
||||
" Author: toastal <toastal@posteo.net>
|
||||
" Description: Dhall's package freezing
|
||||
|
||||
call ale#Set('dhall_freeze_options', '')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
" Author: toastal <toastal@protonmail.com>
|
||||
" Author: toastal <toastal@posteo.net>
|
||||
" Description: Dhall’s built-in linter/formatter
|
||||
|
||||
function! ale#fixers#dhall_lint#Fix(buffer) abort
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
" Author: toastal <toastal@posteo.net>
|
||||
" Description: Integration of purs-tidy with ALE.
|
||||
|
||||
call ale#Set('purescript_tidy_executable', 'purs-tidy')
|
||||
call ale#Set('purescript_tidy_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('purescript_tidy_options', '')
|
||||
|
||||
function! ale#fixers#purs_tidy#GetExecutable(buffer) abort
|
||||
return ale#path#FindExecutable(a:buffer, 'purescript_tidy', [
|
||||
\ 'node_modules/purescript-tidy/bin/index.js',
|
||||
\ 'node_modules/.bin/purs-tidy',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#purs_tidy#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#purs_tidy#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'purescript_tidy_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' %s',
|
||||
\ 'read_temporary_file': 0,
|
||||
\}
|
||||
endfunction
|
||||
|
|
@ -30,6 +30,33 @@ g:ale_purescript_ls_config g:ale_purescript_ls_config
|
|||
\ }
|
||||
\}
|
||||
===============================================================================
|
||||
purs-tidy *ale-purescript-tidy*
|
||||
|
||||
g:ale_purescript_tidy_executable *g:ale_purescript_tidy_executable*
|
||||
*b:ale_purescript_tidy_executable*
|
||||
Type: |String|
|
||||
Default: `'purs-tidy'`
|
||||
|
||||
This variable can be changed to use a different executable for purs-tidy.
|
||||
|
||||
g:ale_purescript_tidy_use_global *g:ale_purescript_tidy_use_global*
|
||||
*b:ale_purescript_tidy_use_global*
|
||||
Type: |Number|
|
||||
Default: `get(g:, 'ale_use_global_executables', 0)`
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
g:ale_purescript_tidy_options *g:ale_purescript_tidy_options*
|
||||
*b:ale_purescript_tidy_options*
|
||||
Type: String
|
||||
Default: `''`
|
||||
|
||||
This variable can be set to pass in additional option to the 'purs-tidy'
|
||||
executable.
|
||||
>
|
||||
let g:ale_purescript_options = '--indent 3'
|
||||
<
|
||||
===============================================================================
|
||||
purty *ale-purescript-purty*
|
||||
|
||||
g:ale_purescript_purty_executable *g:ale_purescript_purty_executable*
|
||||
|
|
|
@ -399,6 +399,7 @@ Notes:
|
|||
* `puppet-lint`
|
||||
* PureScript
|
||||
* `purescript-language-server`
|
||||
* `purs-tidy`
|
||||
* `purty`
|
||||
* Python
|
||||
* `autoflake`!!
|
||||
|
|
|
@ -2933,6 +2933,7 @@ documented in additional help files.
|
|||
puppet-languageserver.................|ale-puppet-languageserver|
|
||||
purescript..............................|ale-purescript-options|
|
||||
purescript-language-server............|ale-purescript-language-server|
|
||||
purs-tidy.............................|ale-purescript-tidy|
|
||||
purty.................................|ale-purescript-purty|
|
||||
pyrex (cython)..........................|ale-pyrex-options|
|
||||
cython................................|ale-pyrex-cython|
|
||||
|
|
|
@ -408,6 +408,7 @@ formatting.
|
|||
* [puppet-lint](https://puppet-lint.com)
|
||||
* PureScript
|
||||
* [purescript-language-server](https://github.com/nwolverson/purescript-language-server)
|
||||
* [purs-tidy](https://github.com/natefaubion/purescript-tidy)
|
||||
* [purty](https://gitlab.com/joneshf/purty)
|
||||
* Python
|
||||
* [autoflake](https://github.com/myint/autoflake)
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
Before:
|
||||
Save g:ale_purescript_tidy_executable
|
||||
Save g:ale_purescript_tidy_options
|
||||
|
||||
" Use an invalid global executable, so we don’t match it.
|
||||
let g:ale_purescript_tidy_executable = 'odd-purs-tidy'
|
||||
let g:ale_purescript_tidy_options = '--indent 3'
|
||||
|
||||
call ale#assert#SetUpFixerTest('purescript', 'purs-tidy')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The purs-tidy callback should return the correct custom options):
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#Escape('odd-purs-tidy')
|
||||
\ . ' --indent 3'
|
||||
\ . ' %s',
|
||||
\ 'read_temporary_file': 0,
|
||||
\ }
|
Loading…
Reference in New Issue