diff options
author | LEI <guillaume.frichet@gmail.com> | 2018-09-08 00:55:26 +0200 |
---|---|---|
committer | LEI <guillaume.frichet@gmail.com> | 2018-09-08 01:34:10 +0200 |
commit | a97ef49c5174f5d60f2dc68718d96965361f3d4e (patch) | |
tree | addef6b9a9b5b41fe81a5632c4eba95ba047378c /autoload | |
parent | 0ae4ea23c8573f9c693fcd5cd5ff9a3acc795b58 (diff) | |
download | ale-a97ef49c5174f5d60f2dc68718d96965361f3d4e.zip |
Add support for sqlfmt
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fix/registry.vim | 5 | ||||
-rw-r--r-- | autoload/ale/fixers/sqlfmt.vim | 13 |
2 files changed, 18 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index 1ca54a86..5f495fa1 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -195,6 +195,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['sh'], \ 'description': 'Fix sh files with shfmt.', \ }, +\ 'sqlfmt': { +\ 'function': 'ale#fixers#sqlfmt#Fix', +\ 'suggested_filetypes': ['sql'], +\ 'description': 'Fix SQL files with sqlfmt.', +\ }, \ 'google_java_format': { \ 'function': 'ale#fixers#google_java_format#Fix', \ 'suggested_filetypes': ['java'], diff --git a/autoload/ale/fixers/sqlfmt.vim b/autoload/ale/fixers/sqlfmt.vim new file mode 100644 index 00000000..c88a8ec2 --- /dev/null +++ b/autoload/ale/fixers/sqlfmt.vim @@ -0,0 +1,13 @@ +call ale#Set('sql_sqlfmt_executable', 'sqlfmt') +call ale#Set('sql_sqlfmt_options', '') + +function! ale#fixers#sqlfmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'sql_sqlfmt_executable') + let l:options = ale#Var(a:buffer, 'sql_sqlfmt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' -w' + \ . (empty(l:options) ? '' : ' ' . l:options), + \} +endfunction |