This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
ale/ale_linters/go/langserver.vim

29 lines
1.1 KiB
VimL
Raw Normal View History

2018-08-30 02:39:03 +00:00
" Author: Horacio Sanson <https://github.com/hsanson>
" Description: Support for go-langserver https://github.com/sourcegraph/go-langserver
call ale#Set('go_langserver_executable', 'go-langserver')
call ale#Set('go_langserver_options', '')
2018-09-06 16:05:05 +00:00
function! ale_linters#go#langserver#GetCommand(buffer) abort
2018-08-30 02:39:03 +00:00
let l:executable = [ale#Escape(ale#Var(a:buffer, 'go_langserver_executable'))]
let l:options = ale#Var(a:buffer, 'go_langserver_options')
let l:options = substitute(l:options, '-gocodecompletion', '', 'g')
let l:options = filter(split(l:options, ' '), 'empty(v:val) != 1')
if ale#Var(a:buffer, 'completion_enabled')
call add(l:options, '-gocodecompletion')
2018-08-30 02:39:03 +00:00
endif
let l:options = uniq(sort(l:options))
return join(extend(l:executable, l:options), ' ')
endfunction
call ale#linter#Define('go', {
\ 'name': 'golangserver',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'go_langserver_executable')},
\ 'command': function('ale_linters#go#langserver#GetCommand'),
\ 'project_root': function('ale#go#FindProjectRoot'),
2018-08-30 02:39:03 +00:00
\})