summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/dhall.vim21
-rw-r--r--autoload/ale/fix/registry.vim15
-rw-r--r--autoload/ale/fixers/dhall_format.vim14
-rw-r--r--autoload/ale/fixers/dhall_freeze.vim18
-rw-r--r--autoload/ale/fixers/dhall_lint.vim14
5 files changed, 82 insertions, 0 deletions
diff --git a/autoload/ale/dhall.vim b/autoload/ale/dhall.vim
new file mode 100644
index 00000000..6e57c4a7
--- /dev/null
+++ b/autoload/ale/dhall.vim
@@ -0,0 +1,21 @@
+" Author: toastal <toastal@protonmail.com>
+" Description: Functions for working with Dhall’s executable
+
+call ale#Set('dhall_executable', 'dhall')
+call ale#Set('dhall_use_global', get(g:, 'ale_use_global_executables', 0))
+call ale#Set('dhall_options', '')
+
+function! ale#dhall#GetExecutable(buffer) abort
+ return ale#Escape(ale#Var(a:buffer, 'dhall_executable'))
+endfunction
+
+function! ale#dhall#GetExecutableWithOptions(buffer) abort
+ let l:executable = ale#dhall#GetExecutable(a:buffer)
+
+ return l:executable
+ \ . ale#Pad(ale#Var(a:buffer, 'dhall_options'))
+endfunction
+
+function! ale#dhall#GetCommand(buffer) abort
+ return '%e ' . ale#Pad(ale#Var(a:buffer, 'dhall_options'))
+endfunction
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 02b02699..3dc5c774 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -32,6 +32,21 @@ let s:default_registry = {
\ 'suggested_filetypes': ['d'],
\ 'description': 'Fix D files with dfmt.',
\ },
+\ 'dhall-format': {
+\ 'function': 'ale#fixers#dhall_format#Fix',
+\ 'suggested_filetypes': ['dhall'],
+\ 'description': 'Standard code formatter for the Dhall language',
+\ },
+\ 'dhall-freeze': {
+\ 'function': 'ale#fixers#dhall_freeze#Freeze',
+\ 'suggested_filetypes': ['dhall'],
+\ 'description': 'Add integrity checks to remote import statements of an expression for the Dhall language',
+\ },
+\ 'dhall-lint': {
+\ 'function': 'ale#fixers#dhall_lint#Fix',
+\ 'suggested_filetypes': ['dhall'],
+\ 'description': 'Standard code formatter for the Dhall language and removing dead code',
+\ },
\ 'fecs': {
\ 'function': 'ale#fixers#fecs#Fix',
\ 'suggested_filetypes': ['javascript', 'css', 'html'],
diff --git a/autoload/ale/fixers/dhall_format.vim b/autoload/ale/fixers/dhall_format.vim
new file mode 100644
index 00000000..214af2c8
--- /dev/null
+++ b/autoload/ale/fixers/dhall_format.vim
@@ -0,0 +1,14 @@
+" Author: toastal <toastal@protonmail.com>
+" Description: Dhall’s built-in formatter
+
+function! ale#fixers#dhall_format#Fix(buffer) abort
+ let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
+ let l:command = l:executable
+ \ . ' format'
+ \ . ' --inplace %t'
+
+ return {
+ \ 'command': l:command,
+ \ 'read_temporary_file': 1,
+ \}
+endfunction
diff --git a/autoload/ale/fixers/dhall_freeze.vim b/autoload/ale/fixers/dhall_freeze.vim
new file mode 100644
index 00000000..74ae7530
--- /dev/null
+++ b/autoload/ale/fixers/dhall_freeze.vim
@@ -0,0 +1,18 @@
+" Author: toastal <toastal@protonmail.com>
+" Description: Dhall’s package freezing
+
+call ale#Set('dhall_freeze_options', '')
+
+function! ale#fixers#dhall_freeze#Freeze(buffer) abort
+ let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
+ let l:command = l:executable
+ \ . ' freeze'
+ \ . ale#Pad(ale#Var(a:buffer, 'dhall_freeze_options'))
+ \ . ' --inplace %t'
+
+
+ return {
+ \ 'command': l:command,
+ \ 'read_temporary_file': 1,
+ \}
+endfunction
diff --git a/autoload/ale/fixers/dhall_lint.vim b/autoload/ale/fixers/dhall_lint.vim
new file mode 100644
index 00000000..2abbe6f7
--- /dev/null
+++ b/autoload/ale/fixers/dhall_lint.vim
@@ -0,0 +1,14 @@
+" Author: toastal <toastal@protonmail.com>
+" Description: Dhall’s built-in linter/formatter
+
+function! ale#fixers#dhall_lint#Fix(buffer) abort
+ let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
+ let l:command = l:executable
+ \ . ' lint'
+ \ . ' --inplace %t'
+
+ return {
+ \ 'command': l:command,
+ \ 'read_temporary_file': 1,
+ \}
+endfunction