summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorSajjad Hashemian <wolaws@gmail.com>2019-05-27 09:00:11 +0430
committerSajjad Hashemian <wolaws@gmail.com>2019-05-27 09:00:11 +0430
commit8d8b295ef5ed60f1c1a978d241a85d922ffe05b5 (patch)
tree506d3f5c2af1898d75950a8f93e28692a72de95e /autoload
parentbb08b81bf719d4c55669c583c65fbe4bbd795501 (diff)
downloadale-8d8b295ef5ed60f1c1a978d241a85d922ffe05b5.zip
add pgformatter
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/pgformatter.vim12
2 files changed, 17 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 3a36f367..925181ca 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -305,6 +305,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['tex'],
\ 'description' : 'Indent code within environments, commands, after headings and within special code blocks.',
\ },
+\ 'pgformatter': {
+\ 'function': 'ale#fixers#pgformatter#Fix',
+\ 'suggested_filetypes': ['sql'],
+\ 'description': 'A PostgreSQL SQL syntax beautifier',
+\ },
\}
" Reset the function registry to the default entries.
diff --git a/autoload/ale/fixers/pgformatter.vim b/autoload/ale/fixers/pgformatter.vim
new file mode 100644
index 00000000..9ea08ec6
--- /dev/null
+++ b/autoload/ale/fixers/pgformatter.vim
@@ -0,0 +1,12 @@
+call ale#Set('sql_pgformatter_executable', 'pg_format')
+call ale#Set('sql_pgformatter_options', '')
+
+function! ale#fixers#pgformatter#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'sql_pgformatter_executable')
+ let l:options = ale#Var(a:buffer, 'sql_pgformatter_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . (empty(l:options) ? '' : ' ' . l:options),
+ \}
+endfunction