mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-05 02:53:29 +08:00
Adds fixer for golines (#3862)
* Adds fixer for golines * Repositions golines docs to be in alphabetical order * Fixes golines doc tag * Fixes formatting for golines docs
This commit is contained in:
@@ -246,6 +246,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['go'],
|
||||
\ 'description': 'Fix Go files imports with goimports.',
|
||||
\ },
|
||||
\ 'golines': {
|
||||
\ 'function': 'ale#fixers#golines#Fix',
|
||||
\ 'suggested_filetypes': ['go'],
|
||||
\ 'description': 'Fix Go file long lines with golines',
|
||||
\ },
|
||||
\ 'gomod': {
|
||||
\ 'function': 'ale#fixers#gomod#Fix',
|
||||
\ 'suggested_filetypes': ['gomod'],
|
||||
|
||||
21
autoload/ale/fixers/golines.vim
Normal file
21
autoload/ale/fixers/golines.vim
Normal file
@@ -0,0 +1,21 @@
|
||||
" Author Pig Frown <pigfrown@protonmail.com>
|
||||
" Description: Fix Go files long lines with golines"
|
||||
|
||||
call ale#Set('go_golines_executable', 'golines')
|
||||
|
||||
call ale#Set('go_golines_options', '')
|
||||
|
||||
function! ale#fixers#golines#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'go_golines_executable')
|
||||
let l:options = ale#Var(a:buffer, 'go_golines_options')
|
||||
let l:env = ale#go#EnvString(a:buffer)
|
||||
|
||||
if !executable(l:executable)
|
||||
return 0
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': l:env . ale#Escape(l:executable)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user