Skip to content

Enable use of Vim's quickfix window and jump to build error features #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions autoload/bazel.vim
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,21 @@ function! bazel#Run(arguments) abort
call s:PLUGIN.logger.Info(
\ 'Invoking bazel with arguments "%s"', string(a:arguments))
call s:Autowrite()
let l:syscall = maktaba#syscall#Create(['bazel'] + a:arguments)
call l:syscall.CallForeground(1, 0)
if a:arguments[0] == "build"
set errorformat=ERROR:\ %f:%l:%c:%m
set errorformat+=%f:%l:%c:%m

" Ignore build output lines starting with INFO:, Loading:, or [
set errorformat+=%-GINFO:\ %.%#
set errorformat+=%-GLoading:\ %.%#
set errorformat+=%-G[%.%#

execute "set makeprg=bazel\\ build\\" substitute(join(a:arguments[1:100]), ' ', '\\ ', 'g')
make
else
let l:syscall = maktaba#syscall#Create(['bazel'] + a:arguments)
call l:syscall.CallForeground(1, 0)
endif
" Note: Intentionally doesn't check v:shell_error.
" Errors are printed on console by bazel, and visible until explicitly
" dismissed because we use CallForeground in pause mode.
Expand Down