mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
(feat) add support for kulala_fmt fixer (#4925)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
* (feat) add support for kulala_fmt fixer Co-authored-by: w0rp <w0rp@users.noreply.github.com>
This commit is contained in:
@@ -129,6 +129,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['hurl'],
|
||||
\ 'description': 'Fix hurl files with hurlfmt.',
|
||||
\ },
|
||||
\ 'kulala_fmt': {
|
||||
\ 'function': 'ale#fixers#kulala_fmt#Fix',
|
||||
\ 'suggested_filetypes': ['http', 'rest'],
|
||||
\ 'description': 'Fix http and rest files with kulala_fmt.',
|
||||
\ },
|
||||
\ 'tidy': {
|
||||
\ 'function': 'ale#fixers#tidy#Fix',
|
||||
\ 'suggested_filetypes': ['html'],
|
||||
|
||||
11
autoload/ale/fixers/kulala_fmt.vim
Normal file
11
autoload/ale/fixers/kulala_fmt.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" Author: hsanson <hsanson@gmail.com>
|
||||
" Description: kulala_fmt fixer for http and rest files.
|
||||
|
||||
call ale#Set('http_kulala_fmt_executable', 'kulala-fmt')
|
||||
|
||||
function! ale#fixers#kulala_fmt#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#Var(a:buffer, 'http_kulala_fmt_executable')) . ' format %t > /dev/null',
|
||||
\ 'read_temporary_file': 1
|
||||
\ }
|
||||
endfunction
|
||||
17
doc/ale-http.txt
Normal file
17
doc/ale-http.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
===============================================================================
|
||||
ALE HTTP Integration *ale-http-options*
|
||||
|
||||
|
||||
===============================================================================
|
||||
kulala_fmt *ale-http-kulala_fmt*
|
||||
|
||||
g:ale_http_kulala_fmt *g:ale_http_kulala_fmt_executable*
|
||||
*b:ale_http_kulala_fmt_executable*
|
||||
Type: |String|
|
||||
Default: `'kulala_fmt'`
|
||||
|
||||
Override the invoked kulala_fmt binary.
|
||||
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
11
doc/ale-rest.txt
Normal file
11
doc/ale-rest.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
===============================================================================
|
||||
ALE REST Integration *ale-rest-options*
|
||||
|
||||
|
||||
===============================================================================
|
||||
kulala_fmt *ale-rest-kulala_fmt*
|
||||
|
||||
See |ale-http-kulala_fmt|
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
@@ -291,6 +291,8 @@ Notes:
|
||||
* djlint
|
||||
* HTML Django
|
||||
* djlint
|
||||
* HTTP
|
||||
* kulala_fmt
|
||||
* Hurl
|
||||
* `hurlfmt`
|
||||
* Idris
|
||||
@@ -569,6 +571,8 @@ Notes:
|
||||
* `cspell`
|
||||
* `opacheck`
|
||||
* `opafmt`
|
||||
* REST
|
||||
* kulala_fmt
|
||||
* reStructuredText
|
||||
* `alex`
|
||||
* `cspell`
|
||||
|
||||
@@ -3123,6 +3123,8 @@ documented in additional help files.
|
||||
djlint................................|ale-htmlangular-djlint|
|
||||
html django template....................|ale-htmldjango-options|
|
||||
djlint................................|ale-htmldjango-djlint|
|
||||
http....................................|ale-http-options|
|
||||
kulala_fmt............................|ale-http-kulala_fmt|
|
||||
hurl....................................|ale-hurl-options|
|
||||
hurlfmt...............................|ale-hurl-hurlfmt|
|
||||
idris...................................|ale-idris-options|
|
||||
@@ -3371,6 +3373,8 @@ documented in additional help files.
|
||||
cspell................................|ale-rego-cspell|
|
||||
opacheck..............................|ale-rego-opa-check|
|
||||
opafmt................................|ale-rego-opa-fmt-fixer|
|
||||
rest....................................|ale-rest-options|
|
||||
kulala_fmt............................|ale-rest-kulala_fmt|
|
||||
restructuredtext........................|ale-restructuredtext-options|
|
||||
cspell................................|ale-restructuredtext-cspell|
|
||||
textlint..............................|ale-restructuredtext-textlint|
|
||||
|
||||
@@ -300,6 +300,8 @@ formatting.
|
||||
* [djlint](https://djlint.com/)
|
||||
* HTML Django
|
||||
* [djlint](https://djlint.com/)
|
||||
* HTTP
|
||||
* [kulala_fmt](https://github.com/mistweaverco/kulala-fmt)
|
||||
* Hurl
|
||||
* [hurlfmt](https://hurl.dev)
|
||||
* Idris
|
||||
@@ -578,6 +580,8 @@ formatting.
|
||||
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
|
||||
* [opacheck](https://www.openpolicyagent.org/docs/latest/cli/#opa-check)
|
||||
* [opafmt](https://www.openpolicyagent.org/docs/latest/cli/#opa-fmt)
|
||||
* REST
|
||||
* [kulala_fmt](https://github.com/mistweaverco/kulala-fmt)
|
||||
* reStructuredText
|
||||
* [alex](https://github.com/get-alex/alex)
|
||||
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
|
||||
|
||||
23
test/fixers/test_kulala_fmt_fixer_callback.vader
Normal file
23
test/fixers/test_kulala_fmt_fixer_callback.vader
Normal file
@@ -0,0 +1,23 @@
|
||||
Before:
|
||||
Save g:ale_http_kulala_fmt_executable
|
||||
|
||||
" Use an invalid global executable, so we don't match it.
|
||||
let g:ale_http_kulala_fmt_executable = 'xxxinvalid'
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The kualala_fmt callback should return the correct default values):
|
||||
call ale#test#SetFilename('../test-files/http/dummy.http')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(g:ale_http_kulala_fmt_executable)
|
||||
\ . ' format %t > /dev/null',
|
||||
\ 'read_temporary_file': 1,
|
||||
\ },
|
||||
\ ale#fixers#kulala_fmt#Fix(bufnr(''))
|
||||
Reference in New Issue
Block a user