Skip to content

job: close quickfix window if a job has succeeded #1123

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

Merged
merged 1 commit into from
Nov 24, 2016
Merged
Show file tree
Hide file tree
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
16 changes: 8 additions & 8 deletions autoload/go/job.vim
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,17 @@ function go#job#Spawn(args)
endif
endif

let l:listtype = go#list#Type("quickfix")
if exitval == 0
call go#list#Clean(0)
call go#list#Window(0)
call go#list#Clean(l:listtype)
call go#list#Window(l:listtype)
return
endif

call self.show_errors()
call self.show_errors(l:listtype)
endfunction

function cbs.show_errors() dict
function cbs.show_errors(listtype) dict
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
try
execute cd self.jobdir
Expand All @@ -84,11 +85,10 @@ function go#job#Spawn(args)
endif

if self.winnr == winnr()
let l:listtype = "quickfix"
call go#list#Populate(l:listtype, errors)
call go#list#Window(l:listtype, len(errors))
call go#list#Populate(a:listtype, errors)
call go#list#Window(a:listtype, len(errors))
if !empty(errors) && !self.bang
call go#list#JumpToFirst(l:listtype)
call go#list#JumpToFirst(a:listtype)
endif
endif
endfunction
Expand Down
6 changes: 3 additions & 3 deletions autoload/go/jobcontrol.vim
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ function! s:on_exit(job_id, exit_status) abort

call s:callback_handlers_on_exit(s:jobs[a:job_id], a:exit_status, std_combined)

let l:listtype = go#list#Type("quickfix")
if a:exit_status == 0
call go#list#Clean(0)
call go#list#Window(0)
call go#list#Clean(l:listtype)
call go#list#Window(l:listtype)

let self.state = "SUCCESS"
call go#util#EchoSuccess("SUCCESS")
Expand All @@ -126,7 +127,6 @@ function! s:on_exit(job_id, exit_status) abort

" if we are still in the same windows show the list
if self.winnr == winnr()
let l:listtype = "locationlist"
call go#list#Populate(l:listtype, errors)
call go#list#Window(l:listtype, len(errors))
if !empty(errors) && !self.bang
Expand Down