Skip to content

Commit

Permalink
do not clear lists when jumping to definition
Browse files Browse the repository at this point in the history
  • Loading branch information
bhcleek committed Aug 23, 2018
1 parent e0b4df1 commit a40877e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion autoload/go/def.vim
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ function! go#def#Jump(mode) abort

call extend(cmd, ["definition", fname . ':#' . go#util#OffsetCursor()])

if go#util#has_job()
if go#util#has_job() || has('nvim')
let l:spawn_args = {
\ 'cmd': cmd,
\ 'complete': function('s:jump_to_declaration_cb', [a:mode, bin_name]),
\ 'for': '_',
\ }

if &modified
Expand Down
7 changes: 7 additions & 0 deletions autoload/go/job.vim
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ endfunction
" See statusline.vim.
" 'for':
" The g:go_list_type_command key to use to get the error list type to use.
" Errors will not be handled when the value is '_'.
" Defaults to '_job'
" 'errorformat':
" The errorformat string to use when parsing errors. Defaults to
Expand Down Expand Up @@ -184,6 +185,10 @@ function! go#job#Options(args)
let cbs.close_cb = function('s:close_cb', [], state)

function state.show_errors(job, exit_status, data)
if self.for == '_'
return
endif

let l:winid = win_getid(winnr())
" Always set the active window to the window that was active when the job
" was started. Among other things, this makes sure that the correct
Expand Down Expand Up @@ -225,6 +230,8 @@ function! go#job#Options(args)
return
endif

" only open the error window if user was still in the window from which
" the job was started.
if self.winid == l:winid
call go#list#Window(l:listtype, len(errors))
if !self.bang
Expand Down

0 comments on commit a40877e

Please sign in to comment.