Use g:ale_linters for turning gometalinter on, and update documentation as appropriate

This commit is contained in:
w0rp 2017-04-15 21:04:43 +01:00
parent 54991f3082
commit f0d76bc298
4 changed files with 20 additions and 10 deletions

View File

@ -1,20 +1,14 @@
" Author: Ben Reedy <https://github.com/breed808> " Author: Ben Reedy <https://github.com/breed808>
" Description: Adds support for the gometalinter suite for Go files " Description: Adds support for the gometalinter suite for Go files
" Disable gometalinter by default
if !exists('g:ale_go_gometalinter_enabled')
let g:ale_go_gometalinter_enabled = 0
endif
if !exists('g:ale_go_gometalinter_options') if !exists('g:ale_go_gometalinter_options')
let g:ale_go_gometalinter_options = '' let g:ale_go_gometalinter_options = ''
endif endif
function! ale_linters#go#gometalinter#GetCommand(buffer) abort function! ale_linters#go#gometalinter#GetCommand(buffer) abort
if g:ale_go_gometalinter_enabled == 1 return 'gometalinter '
return 'gometalinter ' . g:ale_go_gometalinter_options . ' ' . fnameescape(fnamemodify(bufname(a:buffer), ':p:h')) \ . g:ale_go_gometalinter_options
endif \ . ' ' . fnameescape(fnamemodify(bufname(a:buffer), ':p:h'))
return ''
endfunction endfunction
function! ale_linters#go#gometalinter#Handler(buffer, lines) abort function! ale_linters#go#gometalinter#Handler(buffer, lines) abort
@ -49,6 +43,7 @@ function! ale_linters#go#gometalinter#Handler(buffer, lines) abort
\ 'nr': -1, \ 'nr': -1,
\}) \})
endfor endfor
return l:output return l:output
endfunction endfunction

View File

@ -22,6 +22,7 @@ let s:default_ale_linter_aliases = {
" Only cargo is enabled for Rust by default. " Only cargo is enabled for Rust by default.
let s:default_ale_linters = { let s:default_ale_linters = {
\ 'csh': ['shell'], \ 'csh': ['shell'],
\ 'go': ['go build', 'gofmt', 'golint', 'gosimple', 'go vet', 'staticcheck'],
\ 'help': [], \ 'help': [],
\ 'rust': ['cargo'], \ 'rust': ['cargo'],
\ 'text': [], \ 'text': [],

View File

@ -2,6 +2,18 @@
ALE Go Integration *ale-go-options* ALE Go Integration *ale-go-options*
-------------------------------------------------------------------------------
Integration Information
The `gometalinter` linter is disabled by default, and all other Go linters
supported by ALE are enabled by default. To enable `gometalinter`, update
|g:ale_linters| as appropriate:
>
" Enable all of the linters you want for Go.
let g:ale_linters = {'go': ['gometalinter', 'gofmt']}
<
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
gometalinter *ale-go-gometalinter* gometalinter *ale-go-gometalinter*

View File

@ -31,6 +31,8 @@ CONTENTS *ale-contents*
erlc................................|ale-erlang-erlc| erlc................................|ale-erlang-erlc|
fortran...............................|ale-fortran-options| fortran...............................|ale-fortran-options|
gcc.................................|ale-fortran-gcc| gcc.................................|ale-fortran-gcc|
go....................................|ale-go-options|
gometalinter........................|ale-go-gometalinter|
handlebars............................|ale-handlebars-options| handlebars............................|ale-handlebars-options|
ember-template-lint.................|ale-handlebars-embertemplatelint| ember-template-lint.................|ale-handlebars-embertemplatelint|
html..................................|ale-html-options| html..................................|ale-html-options|
@ -123,7 +125,7 @@ The following languages and tools are supported.
* Elm: 'elm-make' * Elm: 'elm-make'
* Erlang: 'erlc' * Erlang: 'erlc'
* Fortran: 'gcc' * Fortran: 'gcc'
* Go: 'gofmt -e', 'go vet', 'golint', 'go build', 'gosimple', 'staticcheck' * Go: 'gofmt', 'go vet', 'golint', 'go build', 'gosimple', 'staticcheck'
* Haml: 'hamllint' * Haml: 'hamllint'
* Handlebars: 'ember-template-lint' * Handlebars: 'ember-template-lint'
* Haskell: 'ghc', 'hlint' * Haskell: 'ghc', 'hlint'