Added support for linting of proto files (#1098)

* Added support for linting of proto files
* Added function to get the proper protoc command
This commit is contained in:
Jeff Willette
2017-11-10 18:37:23 +09:00
committed by w0rp
parent a8c5e0f4dc
commit 8bc44ed585
4 changed files with 61 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
" Author: Jeff Willette <jrwillette88@gmail.com>
" Description: run the protoc-gen-lint plugin for the protoc binary
function! ale_linters#proto#protoc_gen_lint#GetCommand(buffer) abort
let l:dirname = expand('#' . a:buffer . ':p:h')
return 'protoc'
\ . ' -I ' . ale#Escape(l:dirname)
\ . ' --lint_out=. ' . '%s'
endfunction
call ale#linter#Define('proto', {
\ 'name': 'protoc-gen-lint',
\ 'lint_file': 1,
\ 'output_stream': 'stderr',
\ 'executable': 'protoc',
\ 'command_callback': 'ale_linters#proto#protoc_gen_lint#GetCommand',
\ 'callback': 'ale#handlers#unix#HandleAsError',
\})