summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2019-08-18 15:37:51 +0100
committerGitHub <noreply@github.com>2019-08-18 15:37:51 +0100
commitddb559b3bed31b81e8189c3caa8074842574f662 (patch)
treec9977af5e3f0213133832df10b977543bbd1957b /autoload
parentee62cc6898e88a292fc790b049e2ee5454d7b957 (diff)
parent221aceb6db48bf6dd848b96432079a629aeeff59 (diff)
downloadale-ddb559b3bed31b81e8189c3caa8074842574f662.zip
Merge pull request #2631 from timlag1305/feat/ada-gnatpp
Add gnatpp fixer for Ada
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/gnatpp.vim17
2 files changed, 22 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index c5ef1544..3850d782 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -325,6 +325,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['python'],
\ 'description': 'Sort Python imports with reorder-python-imports.',
\ },
+\ 'gnatpp': {
+\ 'function': 'ale#fixers#gnatpp#Fix',
+\ 'suggested_filetypes': ['ada'],
+\ 'description': 'Format Ada files with gnatpp.',
+\ },
\}
" Reset the function registry to the default entries.
diff --git a/autoload/ale/fixers/gnatpp.vim b/autoload/ale/fixers/gnatpp.vim
new file mode 100644
index 00000000..bf3d484e
--- /dev/null
+++ b/autoload/ale/fixers/gnatpp.vim
@@ -0,0 +1,17 @@
+" Author: tim <tim@inept.tech>
+" Description: Fix files with gnatpp.
+
+call ale#Set('ada_gnatpp_executable', 'gnatpp')
+call ale#Set('ada_gnatpp_options', '')
+
+function! ale#fixers#gnatpp#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'ada_gnatpp_executable')
+ let l:options = ale#Var(a:buffer, 'ada_gnatpp_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . (!empty(l:options) ? ' ' . l:options : '')
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction