Skip to content

Commit

Permalink
goinfo improvements
Browse files Browse the repository at this point in the history
Info() will not echo PANIC PANIC PANIC if it's called from the
autocommand.
  • Loading branch information
nhooyr committed Mar 13, 2016
1 parent fd5661a commit b28c69d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion autoload/go/complete.vim
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,12 @@ function! go#complete#GetInfo()
return go#complete#GetInfoFromOffset(offset)
endfunction

function! go#complete#Info()
function! go#complete#Info(auto)
" auto is true if we were called by g:go_auto_type_info's autocmd
let result = go#complete#GetInfo()
if !empty(result)
" if auto, and the result is a PANIC by gocode, hide it
if a:auto && result ==# 'PANIC PANIC PANIC' | return | endif
echo "vim-go: " | echohl Function | echon result | echohl None
endif
endfunction
Expand Down
2 changes: 1 addition & 1 deletion ftplugin/go/commands.vim
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ command! -nargs=? GoOracleTags call go#oracle#Tags(<f-args>)
" tool
command! -nargs=0 GoFiles echo go#tool#Files()
command! -nargs=0 GoDeps echo go#tool#Deps()
command! -nargs=* GoInfo call go#complete#Info()
command! -nargs=* GoInfo call go#complete#Info(0)

" cmd
command! -nargs=* -bang GoBuild call go#cmd#Build(<bang>0,<f-args>)
Expand Down
2 changes: 1 addition & 1 deletion ftplugin/go/mappings.vim
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ nnoremap <silent> <Plug>(go-coverage) :<C-u>call go#cmd#Coverage(!g:go_jump_to_e
nnoremap <silent> <Plug>(go-files) :<C-u>call go#tool#Files()<CR>
nnoremap <silent> <Plug>(go-deps) :<C-u>call go#tool#Deps()<CR>
nnoremap <silent> <Plug>(go-info) :<C-u>call go#complete#Info()<CR>
nnoremap <silent> <Plug>(go-info) :<C-u>call go#complete#Info(0)<CR>
nnoremap <silent> <Plug>(go-import) :<C-u>call go#import#SwitchImport(1, '', expand('<cword>'), '')<CR>
nnoremap <silent> <Plug>(go-implements) :<C-u>call go#oracle#Implements(-1)<CR>
Expand Down
2 changes: 1 addition & 1 deletion plugin/go.vim
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ augroup vim-go

" GoInfo automatic update
if get(g:, "go_auto_type_info", 0)
autocmd CursorHold *.go nested call go#complete#Info()
autocmd CursorHold *.go nested call go#complete#Info(1)
endif

" Echo the identifier information when completion is done. Useful to see
Expand Down

0 comments on commit b28c69d

Please sign in to comment.