From b28c69ddefb3e1b9c88e52a8b0c26c137c1d6141 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Thu, 10 Mar 2016 11:33:09 -0500 Subject: [PATCH] goinfo improvements Info() will not echo PANIC PANIC PANIC if it's called from the autocommand. --- autoload/go/complete.vim | 5 ++++- ftplugin/go/commands.vim | 2 +- ftplugin/go/mappings.vim | 2 +- plugin/go.vim | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/autoload/go/complete.vim b/autoload/go/complete.vim index d295257a92..09461d9a26 100644 --- a/autoload/go/complete.vim +++ b/autoload/go/complete.vim @@ -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 diff --git a/ftplugin/go/commands.vim b/ftplugin/go/commands.vim index 4c6ddba200..51f20e3450 100644 --- a/ftplugin/go/commands.vim +++ b/ftplugin/go/commands.vim @@ -16,7 +16,7 @@ command! -nargs=? GoOracleTags call go#oracle#Tags() " 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(0,) diff --git a/ftplugin/go/mappings.vim b/ftplugin/go/mappings.vim index 68eacc1f68..2529a845d1 100644 --- a/ftplugin/go/mappings.vim +++ b/ftplugin/go/mappings.vim @@ -27,7 +27,7 @@ nnoremap (go-coverage) :call go#cmd#Coverage(!g:go_jump_to_e nnoremap (go-files) :call go#tool#Files() nnoremap (go-deps) :call go#tool#Deps() -nnoremap (go-info) :call go#complete#Info() +nnoremap (go-info) :call go#complete#Info(0) nnoremap (go-import) :call go#import#SwitchImport(1, '', expand(''), '') nnoremap (go-implements) :call go#oracle#Implements(-1) diff --git a/plugin/go.vim b/plugin/go.vim index 63b42cebe0..dc6f80073c 100644 --- a/plugin/go.vim +++ b/plugin/go.vim @@ -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