summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorTim Lagnese <timlag1305@gmail.com>2019-07-01 20:49:12 -0400
committerTim Lagnese <timlag1305@gmail.com>2019-07-01 20:50:02 -0400
commit221aceb6db48bf6dd848b96432079a629aeeff59 (patch)
tree0c18fb822ebcd8f8a1d641aad299fb6a12ce0ae6 /autoload
parent6feeca793ad7df7e947defac7a9c0f8b70972a0f (diff)
downloadale-221aceb6db48bf6dd848b96432079a629aeeff59.zip
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 1a8d02ef..a3ec265e 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -315,6 +315,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