diff options
author | Mohammed Chelouti <70812484+motato1@users.noreply.github.com> | 2020-12-27 01:18:53 +0100 |
---|---|---|
committer | Mohammed Chelouti <70812484+motato1@users.noreply.github.com> | 2021-01-22 19:06:52 +0100 |
commit | 4f2666265a09cceac2e4091dc871107e418f1f67 (patch) | |
tree | 2511652bf33e4f83dbbf20b0760cbd68f45002ef /autoload | |
parent | 33f2f8ddcd9d934c6eef0dc3bf6c434d00aaa734 (diff) | |
download | ale-4f2666265a09cceac2e4091dc871107e418f1f67.zip |
feat: Add Deno fmt fixer
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fix/registry.vim | 5 | ||||
-rw-r--r-- | autoload/ale/fixers/deno.vim | 17 | ||||
-rw-r--r-- | autoload/ale/handlers/deno.vim | 9 |
3 files changed, 31 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index 4564954b..a591a57b 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -32,6 +32,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['python'], \ 'description': 'Fix PEP8 issues with black.', \ }, +\ 'deno': { +\ 'function': 'ale#fixers#deno#Fix', +\ 'suggested_filetypes': ['typescript'], +\ 'description': 'Fix TypeScript using deno fmt.', +\ }, \ 'dfmt': { \ 'function': 'ale#fixers#dfmt#Fix', \ 'suggested_filetypes': ['d'], diff --git a/autoload/ale/fixers/deno.vim b/autoload/ale/fixers/deno.vim new file mode 100644 index 00000000..7154c6ee --- /dev/null +++ b/autoload/ale/fixers/deno.vim @@ -0,0 +1,17 @@ +function! ale#fixers#deno#Fix(buffer) abort + let l:executable = ale#handlers#deno#GetExecutable(a:buffer) + + if !executable(l:executable) + return 0 + endif + + let l:options = ' fmt -' + + if ale#Var(a:buffer, 'deno_unstable') + let l:options = l:options . ' --unstable' + endif + + return { + \ 'command': ale#Escape(l:executable) . l:options + \} +endfunction diff --git a/autoload/ale/handlers/deno.vim b/autoload/ale/handlers/deno.vim new file mode 100644 index 00000000..636c25da --- /dev/null +++ b/autoload/ale/handlers/deno.vim @@ -0,0 +1,9 @@ +" Author: Mohammed Chelouti - https://github.com/motato1 +" Description: Handler functions for Deno. + +call ale#Set('deno_executable', 'deno') +call ale#Set('deno_unstable', 0) + +function! ale#handlers#deno#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'deno_executable') +endfunction |