mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-28 23:06:51 +08:00
feat: Add protolint as linter and fixer (#2911)
This commit is contained in:
@@ -346,6 +346,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['json'],
|
||||
\ 'description': 'Fix JSON files with jq.',
|
||||
\ },
|
||||
\ 'protolint': {
|
||||
\ 'function': 'ale#fixers#protolint#Fix',
|
||||
\ 'suggested_filetypes': ['proto'],
|
||||
\ 'description': 'Fix Protocol Buffer files with protolint.',
|
||||
\ },
|
||||
\ 'perltidy': {
|
||||
\ 'function': 'ale#fixers#perltidy#Fix',
|
||||
\ 'suggested_filetypes': ['perl'],
|
||||
|
||||
26
autoload/ale/fixers/protolint.vim
Normal file
26
autoload/ale/fixers/protolint.vim
Normal file
@@ -0,0 +1,26 @@
|
||||
" Author: Yohei Yoshimuta <yoheimuta@gmail.com>
|
||||
" Description: Integration of protolint with ALE.
|
||||
|
||||
call ale#Set('proto_protolint_executable', 'protolint')
|
||||
call ale#Set('proto_protolint_config', '')
|
||||
|
||||
function! ale#fixers#protolint#GetExecutable(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'proto_protolint_executable')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#protolint#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#protolint#GetExecutable(a:buffer)
|
||||
let l:config = ale#Var(a:buffer, 'proto_protolint_config')
|
||||
|
||||
return {
|
||||
\ 'command': l:executable
|
||||
\ . (!empty(l:config) ? ' -config_path=' . ale#Escape(l:config) : '')
|
||||
\ . ' -fix'
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
|
||||
|
||||
Reference in New Issue
Block a user