Skip to content
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

cmd: make :GoRun async #3525

Open
wants to merge 1 commit 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
cmd: make :GoRun async
Make go#cmd#Run execute `go run` asynchronously. This will slightly
depart from the previous handling of stderr output. With the :make
approach, any output to stderr will populate the quickfix window. When
run as a job, though, the output will only be parsed as an error if the
program being run exits non-zero. See
#3085 (comment) for
more information.
  • Loading branch information
bhcleek committed Feb 16, 2023
commit 492d423f15d68805b3115a3d12bdd7811568d892
33 changes: 19 additions & 14 deletions autoload/go/cmd.vim
Original file line number Diff line number Diff line change
@@ -138,20 +138,6 @@ function! go#cmd#Run(bang, ...) abort
return
endif

if go#util#has_job()
" NOTE(arslan): 'term': 'open' case is not implement for +jobs. This means
" executions waiting for stdin will not work. That's why we don't do
" anything. Once this is implemented we're going to make :GoRun async
endif

let l:status = {
\ 'desc': 'current status',
\ 'type': 'run',
\ 'state': "started",
\ }

call go#statusline#Update(expand('%:p:h'), l:status)

let l:cmd = ['go', 'run']
let l:tags = go#config#BuildTags()
if len(l:tags) > 0
@@ -165,6 +151,25 @@ function! go#cmd#Run(bang, ...) abort
endif

let l:cmd = l:cmd + l:files
" NOTE(arslan): 'term': 'open' case is not implement for +jobs. This means
" executions waiting for stdin will not work.
if go#util#has_job()
call s:cmd_job({
\ 'cmd': l:cmd,
\ 'bang': a:bang,
\ 'for': 'GoRun',
\ 'statustype': 'run',
\ 'errorformat': s:runerrorformat()
\})
return
endif

let l:status = {
\ 'desc': 'current status',
\ 'type': 'run',
\ 'state': "started",
\ }
call go#statusline#Update(expand('%:p:h'), l:status)

if go#util#IsWin()
if go#util#HasDebug('shell-commands')