diff options
author | Trevor Whitney <trevorjwhitney@gmail.com> | 2021-09-20 19:49:15 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-21 10:49:15 +0900 |
commit | f8a4c78b5b293d11da9075373c9de0bb5afdeffe (patch) | |
tree | dd04aca1ee0b8f8cb5c91c0aac5172f8de607f07 /autoload | |
parent | 2f72a3ed1972d23a5ef50c78715ec68f090932e8 (diff) | |
download | ale-f8a4c78b5b293d11da9075373c9de0bb5afdeffe.zip |
Add support for jsonnetfmt and jsonnet-lint (#3907)
* update to lates
Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.com>
* fix up docs
Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.com>
* fix docs
Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.com>
* get tests passing
Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.com>
* update regex
Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.com>
* use ale#Pad and AssertFixer
Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.com>
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fix/registry.vim | 5 | ||||
-rw-r--r-- | autoload/ale/fixers/jsonnetfmt.vim | 18 |
2 files changed, 23 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index 975d02f6..0447bd3e 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -486,6 +486,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['haskell'], \ 'description': 'A formatter for Haskell source code.', \ }, +\ 'jsonnetfmt': { +\ 'function': 'ale#fixers#jsonnetfmt#Fix', +\ 'suggested_filetypes': ['jsonnet'], +\ 'description': 'Fix jsonnet files with jsonnetfmt', +\ }, \ 'ptop': { \ 'function': 'ale#fixers#ptop#Fix', \ 'suggested_filetypes': ['pascal'], diff --git a/autoload/ale/fixers/jsonnetfmt.vim b/autoload/ale/fixers/jsonnetfmt.vim new file mode 100644 index 00000000..f1e41cd5 --- /dev/null +++ b/autoload/ale/fixers/jsonnetfmt.vim @@ -0,0 +1,18 @@ +" Authors: Trevor Whitney <trevorjwhitney@gmail.com> and Takuya Kosugiyama <re@itkq.jp> +" Description: Integration of jsonnetfmt with ALE. + +call ale#Set('jsonnet_jsonnetfmt_executable', 'jsonnetfmt') +call ale#Set('jsonnet_jsonnetfmt_options', '') + +function! ale#fixers#jsonnetfmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_executable') + let l:options = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' -i' + \ . ale#Pad(l:options) + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction |