mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-07 10:21:05 +08:00
Add erlfmt fixer to the registry and use it with stdin (#4868)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-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-06-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
* Add erlfmt fixer to the registry Without this, the fixer will not appear in the list of suggested tools and cannot be used without additional configuration. * Handle stdin in the erlfmt fixer command Previously, the full path to the file being edited was used, which resulted in the loss of unsaved changes. * Add executable selection tests for erlfmt fixer
This commit is contained in:
committed by
GitHub
parent
c9df465148
commit
0551602b19
@@ -109,6 +109,11 @@ let s:default_registry = {
|
||||
\ 'description': 'Indent with the Erlang mode for Emacs',
|
||||
\ 'aliases': ['erlang-mode'],
|
||||
\ },
|
||||
\ 'erlfmt': {
|
||||
\ 'function': 'ale#fixers#erlfmt#Fix',
|
||||
\ 'suggested_filetypes': ['erlang'],
|
||||
\ 'description': 'Format Erlang code with erlfmt',
|
||||
\ },
|
||||
\ 'fecs': {
|
||||
\ 'function': 'ale#fixers#fecs#Fix',
|
||||
\ 'suggested_filetypes': ['javascript', 'css', 'html'],
|
||||
|
||||
@@ -13,9 +13,7 @@ function! ale#fixers#erlfmt#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'erlang_erlfmt_options')
|
||||
let l:executable = ale#fixers#erlfmt#GetExecutable(a:buffer)
|
||||
|
||||
let l:command = ale#Escape(l:executable) . (empty(l:options) ? '' : ' ' . l:options) . ' %s'
|
||||
let l:command = ale#Escape(l:executable) . ale#Pad(l:options) . ' -'
|
||||
|
||||
return {
|
||||
\ 'command': l:command
|
||||
\}
|
||||
return {'command': l:command}
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user