summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/crystal.vim14
2 files changed, 19 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index c80d2271..7be730f4 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -431,6 +431,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['hcl', 'terraform'],
\ 'description': 'Fix tf and hcl files with terraform fmt.',
\ },
+\ 'crystal': {
+\ 'function': 'ale#fixers#crystal#Fix',
+\ 'suggested_filetypes': ['cr'],
+\ 'description': 'Fix cr (crystal).',
+\ },
\ 'ktlint': {
\ 'function': 'ale#fixers#ktlint#Fix',
\ 'suggested_filetypes': ['kt', 'kotlin'],
diff --git a/autoload/ale/fixers/crystal.vim b/autoload/ale/fixers/crystal.vim
new file mode 100644
index 00000000..4ba702ba
--- /dev/null
+++ b/autoload/ale/fixers/crystal.vim
@@ -0,0 +1,14 @@
+call ale#Set('crystal_format_executable', 'crystal')
+call ale#Set('crystal_format_options', '')
+
+function! ale#fixers#crystal#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'crystal_format_executable')
+ let l:options = ale#Var(a:buffer, 'crystal_format_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . ' tool format'
+ \ . ale#Pad(l:options)
+ \ . ' -'
+ \}
+endfunction