mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -5,11 +5,13 @@ call ale#Set('go_bingo_executable', 'bingo')
|
||||
call ale#Set('go_bingo_options', '--mode stdio')
|
||||
|
||||
function! ale_linters#go#bingo#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'go_bingo_options'))
|
||||
return ale#go#EnvString(a:buffer) . '%e' . ale#Pad(ale#Var(a:buffer, 'go_bingo_options'))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#bingo#FindProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'go.mod')
|
||||
let l:go_modules_off = ale#Var(a:buffer, 'go_go111module') is# 'off'
|
||||
let l:project_root = l:go_modules_off ?
|
||||
\ '' : ale#path#FindNearestFile(a:buffer, 'go.mod')
|
||||
let l:mods = ':h'
|
||||
|
||||
if empty(l:project_root)
|
||||
|
@ -11,6 +11,7 @@ function! ale_linters#go#gobuild#GetCommand(buffer) abort
|
||||
|
||||
" Run go test in local directory with relative path
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
\ . ale#Var(a:buffer, 'go_go_executable') . ' test'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -c -o /dev/null ./'
|
||||
|
@ -1,10 +1,16 @@
|
||||
" Author: neersighted <bjorn@neersighted.com>
|
||||
" Description: gofmt for Go files
|
||||
|
||||
function! ale_linters#go#gofmt#GetCommand(buffer) abort
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . '%e -e %t'
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gofmt',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'gofmt',
|
||||
\ 'command': 'gofmt -e %t',
|
||||
\ 'command': function('ale_linters#go#gofmt#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
||||
|
@ -10,13 +10,16 @@ function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_golangci_lint_options')
|
||||
let l:lint_package = ale#Var(a:buffer, 'go_golangci_lint_package')
|
||||
|
||||
|
||||
if l:lint_package
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
\ . '%e run '
|
||||
\ . l:options
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
\ . '%e run '
|
||||
\ . ale#Escape(l:filename)
|
||||
\ . ' ' . l:options
|
||||
|
@ -7,7 +7,7 @@ call ale#Set('go_golint_options', '')
|
||||
function! ale_linters#go#golint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_golint_options')
|
||||
|
||||
return '%e'
|
||||
return ale#go#EnvString(a:buffer) . '%e'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
@ -14,11 +14,13 @@ function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
||||
" be calculated to absolute paths in the Handler
|
||||
if l:lint_package
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
\ . '%e'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
\ . '%e'
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename))
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
|
@ -6,11 +6,15 @@ call ale#Set('go_gopls_executable', 'gopls')
|
||||
call ale#Set('go_gopls_options', '--mode stdio')
|
||||
|
||||
function! ale_linters#go#gopls#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'go_gopls_options'))
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'go_gopls_options'))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gopls#FindProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'go.mod')
|
||||
let l:go_modules_off = ale#Var(a:buffer, 'go_go111module') is# 'off'
|
||||
let l:project_root = l:go_modules_off ?
|
||||
\ '' : ale#path#FindNearestFile(a:buffer, 'go.mod')
|
||||
let l:mods = ':h'
|
||||
|
||||
if empty(l:project_root)
|
||||
|
@ -2,7 +2,8 @@
|
||||
" Description: gosimple for Go files
|
||||
|
||||
function! ale_linters#go#gosimple#GetCommand(buffer) abort
|
||||
return ale#path#BufferCdString(a:buffer) . ' gosimple .'
|
||||
return ale#path#BufferCdString(a:buffer) . ' '
|
||||
\ . ale#go#EnvString(a:buffer) . 'gosimple .'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
|
@ -6,7 +6,8 @@ function! ale_linters#go#gotype#GetCommand(buffer) abort
|
||||
return ''
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer) . ' gotype -e .'
|
||||
return ale#path#BufferCdString(a:buffer) . ' '
|
||||
\ . ale#go#EnvString(a:buffer) . 'gotype -e .'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
|
@ -11,6 +11,7 @@ function! ale_linters#go#govet#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_govet_options')
|
||||
|
||||
return ale#path#BufferCdString(a:buffer) . ' '
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
\ . ale#Var(a:buffer, 'go_go_executable') . ' vet '
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' .'
|
||||
|
@ -15,8 +15,9 @@ function! ale_linters#go#langserver#GetCommand(buffer) abort
|
||||
endif
|
||||
|
||||
let l:options = uniq(sort(l:options))
|
||||
let l:env = ale#go#EnvString(a:buffer)
|
||||
|
||||
return join(extend(l:executable, l:options), ' ')
|
||||
return l:env . join(extend(l:executable, l:options), ' ')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
|
@ -8,17 +8,18 @@ function! ale_linters#go#staticcheck#GetCommand(buffer) abort
|
||||
let l:filename = expand('#' . a:buffer . ':t')
|
||||
let l:options = ale#Var(a:buffer, 'go_staticcheck_options')
|
||||
let l:lint_package = ale#Var(a:buffer, 'go_staticcheck_lint_package')
|
||||
let l:env = ale#go#EnvString(a:buffer)
|
||||
|
||||
" BufferCdString is used so that we can be sure the paths output from
|
||||
" staticcheck can be calculated to absolute paths in the Handler
|
||||
if l:lint_package
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . 'staticcheck'
|
||||
\ . l:env . 'staticcheck'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . 'staticcheck'
|
||||
\ . l:env . 'staticcheck'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' ' . ale#Escape(l:filename)
|
||||
endfunction
|
||||
|
Reference in New Issue
Block a user