summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorCluas <Cluas@live.cn>2019-09-13 05:48:27 +0800
committerw0rp <w0rp@users.noreply.github.com>2019-09-12 22:48:27 +0100
commita6c59faa0f4b7f6226859c1a9b5bae83b1aef295 (patch)
treea857dcdd533ef25b14189908bdac780363e17cca /autoload
parent3e8c8d3ccbead8a6540b782686ab3751361a4ec1 (diff)
downloadale-a6c59faa0f4b7f6226859c1a9b5bae83b1aef295.zip
feat: support sqlformat. (#2702)
* feat: support sqlformat.
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/sqlformat.vim16
2 files changed, 21 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index d21cb227..ace37207 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -260,6 +260,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['sql'],
\ 'description': 'Fix SQL files with sqlfmt.',
\ },
+\ 'sqlformat': {
+\ 'function': 'ale#fixers#sqlformat#Fix',
+\ 'suggested_filetypes': ['sql'],
+\ 'description': 'Fix SQL files with sqlformat.',
+\ },
\ 'google_java_format': {
\ 'function': 'ale#fixers#google_java_format#Fix',
\ 'suggested_filetypes': ['java'],
diff --git a/autoload/ale/fixers/sqlformat.vim b/autoload/ale/fixers/sqlformat.vim
new file mode 100644
index 00000000..6319c1ac
--- /dev/null
+++ b/autoload/ale/fixers/sqlformat.vim
@@ -0,0 +1,16 @@
+" Author: Cluas <Cluas@live.cn>
+" Description: Fixing files with sqlformat.
+
+call ale#Set('sql_sqlformat_executable', 'sqlformat')
+call ale#Set('sql_sqlformat_options', '')
+
+function! ale#fixers#sqlformat#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'sql_sqlformat_executable')
+ let l:options = ale#Var(a:buffer, 'sql_sqlformat_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . (!empty(l:options) ? ' ' . l:options : '')
+ \ . ' -'
+ \}
+endfunction