mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-19 16:24:20 +08:00
feat: add yamlfix fixer
This commit is contained in:
@@ -110,6 +110,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': [],
|
||||
\ 'description': 'Remove all trailing whitespace characters at the end of every line.',
|
||||
\ },
|
||||
\ 'yamlfix': {
|
||||
\ 'function': 'ale#fixers#yamlfix#Fix',
|
||||
\ 'suggested_filetypes': ['python'],
|
||||
\ 'description': 'Fix yaml files with yamlfix.',
|
||||
\ },
|
||||
\ 'yapf': {
|
||||
\ 'function': 'ale#fixers#yapf#Fix',
|
||||
\ 'suggested_filetypes': ['python'],
|
||||
|
||||
25
autoload/ale/fixers/yamlfix.vim
Normal file
25
autoload/ale/fixers/yamlfix.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
" Author: lyz-code
|
||||
" Description: Fixing yaml files with yamlfix.
|
||||
|
||||
call ale#Set('yaml_yamlfix_executable', 'yamlfix')
|
||||
call ale#Set('yaml_yamlfix_options', '')
|
||||
call ale#Set('yaml_yamlfix_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale#fixers#yamlfix#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'yaml_yamlfix_options')
|
||||
|
||||
let l:executable = ale#python#FindExecutable(
|
||||
\ a:buffer,
|
||||
\ 'yaml_yamlfix',
|
||||
\ ['yamlfix'],
|
||||
\)
|
||||
|
||||
if !executable(l:executable)
|
||||
return 0
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape(l:executable) . (!empty(l:options) ? ' ' . l:options : '') . ' -',
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user