fatih / vim-go

Go development plugin for Vim
https://www.patreon.com/bhcleek
Other
16.02k stars 1.45k forks source link

Error when I hover a package within the import section #2514

Closed msvitok77 closed 5 years ago

msvitok77 commented 5 years ago

What did you do? (required: The issue will be closed when not provided)

I have a simple code like this: package messaging

import ( "go.uber.org/zap" "google.golang.org/grpc" )

type Producer struct { lg zap.SugaredLogger conn grpc.ClientConn }

when I hover the grpc package within the import section It throws an error

What did you expect to happen?

If not some useful information than at least not an error at all.

What happened instead?

Error detected while processing function 16[13]..19[26]..74_hoverHandler: line 1: E121: Undefined variable: contents E116: Invalid arguments for function split(a:msg.contents.value, '; ') E15: Invalid expression: split(a:msg.contents.value, '; ') Error detected while processing function 16: line 13: E171: Missing :endif

Configuration (MUST fill this out):

Installed using vim plug. I have no special configuration for this pluggin.

vim-go version:

Latest: commit e62b7405c57f4030fbcfbab6952124672c9ca0a7

vimrc you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc):

vimrc
call plug#begin('~/.vim/plugged')
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
call plug#end()

let g:go_list_type = "quickfix"
let g:go_list_type = "quickfix"
let g:go_fmt_command = "goimports"
let g:go_textobj_include_function_doc = 0
let g:go_addtags_transform = "camelcase"
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_operators = 1
let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']
let g:go_metalinter_autosave = 1
let g:go_metalinter_autosave_enabled = ['vet', 'golint']
let g:go_metalinter_deadline = "5s"
let g:go_def_mode = 'godef'
let g:go_decls_includes = "func,type"
autocmd FileType go nmap d :GoDoc
let g:go_auto_type_info = 1
set updatetime=100

Vim version (first three lines from :version):

VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun 07 2019 11:42:36)

Go version (go version):

go version go1.13 linux/amd64

Go environment

go env Output:
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/marek/.cache/go-build"
GOENV="/home/marek/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/marek/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build523934835=/tmp/go-build -gno-record-gcc-switches"

ehrktia commented 5 years ago

Having same issue from past week,have you got YCM and UltiSnips together along with vim-go? Am guessing it a conflict between YCM and gopls not definitive. Trying to debug to get root cause before reporting.

msvitok77 commented 5 years ago

Hello here are the plugins I currently have installed: Plug 'ctrlpvim/ctrlp.vim' Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' } Plug 'SirVer/ultisnips' Plug 'morhetz/gruvbox' Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes'

ehrktia commented 5 years ago

thanks for response , seems this rules out theory of YCM conflict since your bundle does not have YCM have you tried forcing vim-go to use gopls for autocompletion in vimrc?

msvitok77 commented 5 years ago

hmm I thought it has something in common with g:go_info_mode ... which uses gopls by default. I wasn't trying to use autocompletion at that time. However I've changed the godef option to: let g:go_def_mode = 'gopls', but I'm not sure if it's sufficient. Anyway it didn't help. Thanks

bhcleek commented 5 years ago

Which version of gopls are you using? You can use gopls version to find out.

invine commented 5 years ago

Having the same issue gopls version golang.org/x/tools/gopls v0.1.7 golang.org/x/tools/gopls@v0.1.7 h1:YwKf8t9h69++qCtVmc2q6fVuetFXmmu9LKoPMYLZid4=

bhcleek commented 5 years ago

I am unable to duplicate this. I'm trying a simple reproduction of what you provided @yshadow using this file (and it's the only file in the package):

package foo

import (
    "go.uber.org/zap"
    "google.golang.org/grpc"
)

type Producer struct {
    lg   *zap.SugaredLogger
    conn *grpc.ClientConn
}

If you can provide a simple reproduction case, I'm sure we can get to the bottom of the problem.

bhcleek commented 5 years ago

Having the gopls debugging output would be useful. If you can start up vim with -c let g:go_debug['lsp'], you'll get a log window with the gopls output.

msvitok77 commented 5 years ago

hello my gopls version is: golang.org/x/tools/gopls v0.1.7 golang.org/x/tools/gopls@v0.1.7 h1:YwKf8t9h69++qCtVmc2q6fVuetFXmmu9LKoPMYLZid4=

msvitok77 commented 5 years ago

I run vim with -c let g:go_debug['lsp'] and got this output:

"g:go_debug[lsp]" [New File]
airline_detect_crypt  #1
gruvbox_improved_warnings #0
rainbow_conf          {'guifgs': ['#d65d0e', '#cc241d', '#b16286', '#458588'], 'ctermfgs': ['166', 'red', 'magenta', 'blue']}
airline_left_sep
loaded_plug           #1
niji_light_colours    [['blue', '#458588'], ['magenta', '#b16286'], ['red', '#cc241d'], ['166', '#d65d0e']]
loaded_vimballPlugin   v37
vimshell_escape_colors ['#7c6f64', '#fb4934', '#b8bb26', '#fabd2f', '#83a598', '#d3869b', '#8ec07c', '#a89984', '#282828', '#fb4934', '#b8bb26', '#fe8019', '#83a598', '#d3869b', '#8ec07c', '
#fbf1c7']
airline_left_alt_sep
ctrlp_map              
indent_guides_auto_colors #0
did_load_filetypes    #1
airline#extensions#quickfix#location_text  Location
airline_detect_spelllang #1
airline_section_warning  %{airline#util#wrap(airline#extensions#whitespace#check(),0)}
ctrlp_alltags         []
airline#highlighter#normal_fg_hi  223
airline_right_alt_sep
ctrlp_mruf_include
go_auto_type_info     #1
UltiSnipsEnableSnipMate #1
airline_right_sep
UltiSnipsListSnippets  
go_list_type           quickfix
go_metalinter_deadline  5s
go_highlight_fields   #1
airline_symbols       {'space': ' ', 'paste': 'PASTE', 'maxlinenr': ' ㏑', 'dirty': '!', 'crypt': '🔒', 'linenr': '☰ ', 'readonly': '⊝', 'spell': 'SPELL', 'modified': '+', 'notexists': 'Ɇ',
'keymap': 'Keymap:', 'ellipsis': '...', 'branch': 'ᚠ', 'whitespace': '☲'}
niji_dark_colours     [['blue', '#458588'], ['magenta', '#b16286'], ['red', '#cc241d'], ['166', '#d65d0e']]
airline_mode_map      {'s': 'SELECT', 'V': 'V-LINE', 'ni': '(INSERT)', 'ic': 'INSERT COMPL', 'R': 'REPLACE', '^S': 'S-BLOCK', 'no': 'OP PENDING', '^V': 'V-BLOCK', 'multi': 'MULTI', '__': '--
----', 'Rv': 'V REPLACE', 'c': 'COMMAND', 'ix': 'INSERT COMPL', 'i': 'INSERT', 'n': 'NORMAL', 'S': 'S-LINE', 't': 'TERMINAL', 'v': 'VISUAL'}
gitgutter_override_sign_column_highlight #0
gruvbox_undercurl     #1
colors_name            gruvbox
ctrlp_status_func     {'prog': 'airline#extensions#ctrlp#ctrlp_airline_status', 'main': 'airline#extensions#ctrlp#ctrlp_airline'}
did_load_ftplugin     #1
airline_detect_paste  #1
loaded_tarPlugin       v29
ctrlp_mruf_map_string  !stridx(v:val, cwd) ? strpart(v:val, idx) : v:val
airline_detect_spell  #1
ctrlp_cmd              CtrlP
UltiSnipsEditSplit     normal
airline_gui_mode       cterm
matchparen_insert_timeout #60
go_textobj_include_function_doc #0
io_fugitive           {'readfile': function('fugitive#readfile'), 'isdirectory': function('fugitive#isdirectory'), 'getfperm': function('fugitive#getfperm'), 'delete': function('fugitive#del
ete'), 'filereadable': function('fugitive#filereadable'), 'Real': function('FugitiveReal'), 'getftype': function('fugitive#getftype'), 'simplify': function('fugitive#simplify'), 'resolve': f
unction('fugitive#resolve'), 'getfsize': function('fugitive#getfsize'), 'setfperm': function('fugitive#setfperm'), 'glob': function('fugitive#glob'), 'getftime': function('fugitive#getftime'
), 'writefile': function('fugitive#writefile'), 'filewritable': function('fugitive#filewritable')}
loaded_zipPlugin       v28
_uspy                  :py3
UltiSnipsExpandTrigger  
loaded_rrhelper       #1
rbpt_colorpairs       [['blue', '#458588'], ['magenta', '#b16286'], ['red', '#cc241d'], ['166', '#d65d0e']]
airline#extensions#quickfix#quickfix_text  Quickfix
go_metalinter_autosave_enabled ['vet', 'golint']
loaded_spellfile_plugin #1
airline#init#is_windows #0
did_indent_on         #1
ctrlp_ext_vars        []
airline_theme          papercolor
ctrlp_alldirs         []
loaded_airline        #1
plug_home              /home/marek/.vim/plugged
did_plugin_ultisnips  #1
rainbow_guifgs        ['#d65d0e', '#cc241d', '#b16286', '#458588']
airline_section_a      %#__accent_bold#%{airline#util#wrap(airline#parts#mode(),0)}%#__restore__#%{airline#util#append(airline#parts#crypt(),0)}%{airline#util#append(airline#parts#paste(),0)
}%{airline#util#append(airline#extensions#keymap#status(),0)}%{airline#util#append(airline#parts#spell(),0)}%{airline#util#append("",0)}%{airline#util#append("",0)}%{airline#util#append(airl
ine#parts#iminsert(),0)}
UltiSnipsMappingsToIgnore []
ctrlp_builtins        #2
loaded_fugitive       #1
go_decls_includes      func,type
gruvbox_contrast_dark  medium
ctrlp_buftags         {}
plugs_order           ['ctrlp.vim', 'vim-go', 'ultisnips', 'vim-fugitive', 'gruvbox', 'vim-airline', 'vim-airline-themes']
indentLine_color_term #239
airline_inactive_collapse #1
syntax_on             #1
gruvbox_bold          #1
gruvbox_guisp_fallback  NONE
airline_section_x      %{airline#util#prepend("",0)}%{airline#util#prepend(airline#extensions#vista#currenttag(),0)}%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#wrap(airline#parts#filetype(),0)}
airline_section_y      %{airline#util#wrap(airline#parts#ffenc(),0)}
airline_section_z      %3p%% %#__accent_bold#%{g:airline_symbols.linenr}%4l%#__restore__#%#__accent_bold#/%L%{g:airline_symbols.maxlinenr}%#__restore__# :%3v
airline#extensions#wordcount#filetypes ['asciidoc', 'help', 'mail', 'markdown', 'org', 'rst', 'tex', 'text']
UltiSnipsJumpBackwardTrigger  
airline_last_window_changed [1, 1, 1, 1, '']
gruvbox_invert_indent_guides #0
airline_statusline_funcrefs [function('airline#extensions#quickfix#apply'), function('airline#extensions#netrw#apply'), function('airline#extensions#term#apply'), function('airline#extension
s#ctrlp#apply'), function('airline#extensions#po#apply'), function('airline#extensions#wordcount#apply')]
loaded_netrwPlugin     v156
loaded_logiPat         v4
UltiSnipsSnippetDirectories ['UltiSnips']
matchparen_timeout    #300
loaded_airline_themes #1
airline_section_c      %<%<%{airline#extensions#fugitiveline#bufname()}%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#
UltiSnipsJumpForwardTrigger  
airline#init#vim_async #1
go_addtags_transform   camelcase
airline_detect_modified #1
airline_exclude_preview #0
go_highlight_functions #1
loaded_gzip           #1
go_highlight_operators #1
loaded_ctrlp          #1
zipPlugin_ext          *.apk,*.celzip,*.crtx,*.docm,*.docx,*.dotm,*.dotx,*.ear,*.epub,*.gcsx,*.glox,*.gqsx,*.ja,*.jar,*.kmz,*.oxt,*.potm,*.potx,*.ppam,*.ppsm,*.ppsx,*.pptm,*.pptx,*.sldx,*.th
mx,*.vdw,*.war,*.wsz,*.xap,*.xlam,*.xlam,*.xlsb,*.xlsm,*.xlsx,*.xltm,*.xltx,*.xpi,*.zip
ctrlp_allmixes        {}
airline_exclude_filetypes []
airline#themes#papercolor#palette {'accents': {'orange': ['#df5f00', '', 166, ''], 'bold': ['', '', '', '', 'bold'], 'blue': ['#005fff', '', 27, ''], 'green': ['#008700', '', 22, ''], 'purpl
e': ['#af00df', '', 128, ''], 'none': ['', '', '', '', ''], 'italic': ['', '', '', '', 'italic'], 'yellow': ['#dfff00', '', 190, ''], 'red': ['#66d9ef', '', 81, '', '']}, 'inactive': {'airli
ne_x': ['#585858', '#e4e4e4', 240, 254, ''], 'airline_y': ['#585858', '#e4e4e4', 240, 254, ''], 'airline_z': ['#585858', '#e4e4e4', 240, 254, ''], 'airline_term': ['#9cffd3', '#202020', 85,
232, ''], 'airline_error': ['#000000', '#990000', 232, 160, ''], 'airline_a': ['#585858', '#e4e4e4', 240, 254, ''], 'airline_b': ['#585858', '#e4e4e4', 240, 254, ''], 'airline_c': ['#585858'
, '#e4e4e4', 240, 254, ''], 'airline_warning': ['#000000', '#df5f00', 232, 166, '']}, 'replace': {'airline_x': ['#eeeeee', '#005f87', 255, 24, ''], 'airline_y': ['#e4e4e4', '#0087af', 254, 3
1, ''], 'airline_z': ['#585858', '#e4e4e4', 240, 254, ''], 'airline_term': ['#9cffd3', '#202020', 85, 232], 'airline_error': ['#000000', '#990000', 232, 160], 'airline_a': ['#d7005f', '#e4e4
e4', 161, 254, ''], 'airline_b': ['#e4e4e4', '#0087af', 254, 31, ''], 'airline_c': ['#eeeeee', '#005f87', 255, 24, ''], 'airline_warning': ['#000000', '#df5f00', 232, 166]}, 'normal': {'airl
ine_x_to_airline_y': ['', '', '31', '24', ''], 'airline_error': ['#000000', '#990000', 232, 160, ''], 'airline_x': ['#eeeeee', '#005f87', 255, 24, ''], 'airline_y': ['#e4e4e4', '#0087af', 25
4, 31, ''], 'airline_z': ['#585858', '#e4e4e4', 240, 254, ''], 'airline_b_to_airline_c': ['', '', '31', '24', ''], 'airline_warning': ['#000000', '#df5f00', 232, 166, ''], 'airline_a_to_airl
ine_b': ['', '', '254', '31', ''], 'airline_c': ['#eeeeee', '#005f87', 255, 24, ''], 'airline_term': ['#9cffd3', '#202020', 85, 232, ''], 'airline_z_to_airline_warning': ['', '', '166', '254
', ''], 'airline_a': ['#585858', '#e4e4e4', 240, 254, ''], 'airline_b': ['#e4e4e4', '#0087af', 254, 31, ''], 'airline_y_to_airline_z': ['', '', '254', '31', ''], 'airline_c_to_airline_x': ['
', '', '24', '24', '']}, 'normal_modified': {'airline_term': ['#9cffd3', '#202020', 85, 232], 'airline_error': ['#000000', '#990000', 232, 160], 'airline_warning': ['#000000', '#df5f00', 232
, 166], 'airline_c': ['#eeeeee', '#005f87', 255, 24, '']}, 'visual_modified': {'airline_term': ['#9cffd3', '#202020', 85, 232], 'airline_error': ['#000000', '#990000', 232, 160], 'airline_wa
rning': ['#000000', '#df5f00', 232, 166], 'airline_c': ['#e4e4e4', '#005f87', 254, 24]}, 'insert_modified': {'airline_term': ['#9cffd3', '#202020', 85, 232], 'airline_error': ['#000000', '#990000', 232, 160], 'airline_warning': ['#000000', '#df5f00', 232, 166], 'airline_c': ['#eeeeee', '#005f87', 255, 24, '']}, 'inactive_modified': {'airline_term': ['#9cffd3', '#202020', 85, 23
2], 'airline_error': ['#000000', '#990000', 232, 160], 'airline_warning': ['#000000', '#df5f00', 232, 166], 'airline_c': ['#585858', '#e4e4e4', 240, 254, '']}, 'visual': {'airline_x': ['#e4e
4e4', '#005f87', 254, 24, ''], 'airline_y': ['', '#0087af', '', 31, ''], 'airline_z': ['#005f87', '#e4e4e4', 24, 254, ''], 'airline_term': ['#9cffd3', '#202020', 85, 232], 'airline_error': [
'#000000', '#990000', 232, 160], 'airline_a': ['#005f87', '#e4e4e4', 24, 254, ''], 'airline_b': ['', '#0087af', '', 31, ''], 'airline_c': ['#e4e4e4', '#005f87', 254, 24, ''], 'airline_warnin
g': ['#000000', '#df5f00', 232, 166]}, 'replace_modified': {'airline_term': ['#9cffd3', '#202020', 85, 232], 'airline_error': ['#000000', '#990000', 232, 160], 'airline_warning': ['#000000',
 '#df5f00', 232, 166], 'airline_c': ['#eeeeee', '#005f87', 255, 24, '']}, 'insert': {'airline_x': [...], 'airline_y': [...], 'airline_z': [...], 'airline_term': ['#9cffd3', '#202020', 85, 23
2], 'airline_error': ['#000000', '#990000', 232, 160], 'airline_a': ['#585858', '#e4e4e4', 240, 254, ''], 'airline_b': [...], 'airline_c': [...], 'airline_warning': ['#000000', '#df5f00', 23
2, 166]}, 'ctrlp': {'airline_term': ['#9cffd3', '#202020', 85, 232, ''], 'CtrlPwhite': ['#585858', '#e4e4e4', 240, 254, 'bold'], 'CtrlPlight': ['#e4e4e4', '#0087af', 254, 31, ''], 'CtrlPdark
': ['#e4e4e4', '#005f87', 254, 24, ''], 'CtrlParrow1': ['#0087af', '#e4e4e4', 31, 254, ''], 'CtrlParrow2': ['#e4e4e4', '#0087af', 254, 31, ''], 'CtrlParrow3': ['#0087af', '#005f87', 31, 24,
''], 'airline_warning': ['#000000', '#df5f00', 232, 166, ''], 'airline_error': ['#000000', '#990000', 232, 160, '']}}
netrw_force_overwrite_statusline #0
loaded_2html_plugin    vim7.4_v2
gruvbox_termcolors    #256
loaded_matchparen     #1
airline_section_b      %{airline#util#wrap(airline#extensions#branch#get_head(),80)}
airline_section_error
gruvbox_improved_strings #0
ctrlp_mruf_relative   #0
go_metalinter_enabled ['vet', 'golint', 'errcheck']
airline_exclude_filenames ['DebuggerWatch', 'DebuggerStack', 'DebuggerStatus']
go_loaded_install     #1
ctrlp_mruf_exclude
go_def_mode            gopls
airline_theme_map     {'zenburn': 'zenburn', '\CNeoSolarized': 'solarized', 'solarized': 'solarized', 'wombat': 'wombat', '\CTomorrow': 'tomorrow', 'mo[l|n]okai': 'molokai', 'flattened': 'so
larized', 'base16': 'base16', 'default': 'dark'}
ctrlp_mruf_case_sensitive #1
go_metalinter_autosave #1
UltiSnipsRemoveSelectModeMappings #1
loaded_getscriptPlugin  v36
go_highlight_function_calls #1
go_fmt_command         goimports
airline_detect_iminsert #0
rainbow_ctermfgs      ['166', 'red', 'magenta', 'blue']
gruvbox_italic        #0
ctrlp_mruf_save_on_update #1
go_test_timeout        10s
netrw_banner          #0
mapleader              ,
gruvbox_inverse       #1
gruvbox_contrast_light  medium
airline_section_gutter  %=
ctrlp_mruf_max        #250
indentLine_color_gui   #504945
plugs                 {'gruvbox': {'uri': 'https://git::@github.com/morhetz/gruvbox.git', 'dir': '/home/marek/.vim/plugged/gruvbox/', 'frozen': 0, 'branch': 'master'}, 'vim-go': {'uri': 'htt
ps://git::@github.com/fatih/vim-go.git', 'dir': '/home/marek/.vim/plugged/vim-go/', 'frozen': 0, 'branch': 'master', 'do': ':GoInstallBinaries'}, 'vim-airline-themes': {'uri': 'https://git::
@github.com/vim-airline/vim-airline-themes.git', 'dir': '/home/marek/.vim/plugged/vim-airline-themes/', 'frozen': 0, 'branch': 'master'}, 'vim-airline': {'uri': 'https://git::@github.com/vim
-airline/vim-airline.git', 'dir': '/home/marek/.vim/plugged/vim-airline/', 'frozen': 0, 'branch': 'master'}, 'ctrlp.vim': {'uri': 'https://git::@github.com/ctrlpvim/ctrlp.vim.git', 'dir': '/
home/marek/.vim/plugged/ctrlp.vim/', 'frozen': 0, 'branch': 'master'}, 'vim-fugitive': {'uri': 'https://git::@github.com/tpope/vim-fugitive.git', 'dir': '/home/marek/.vim/plugged/vim-fugitiv
e/', 'frozen': 0, 'branch': 'master'}, 'ultisnips': {'uri': 'https://git::@github.com/SirVer/ultisnips.git', 'dir': '/home/marek/.vim/plugged/ultisnips/', 'frozen': 0, 'branch': 'master'}}
ctrlp_allfiles        []
airline#visual_active #0
ctrlp_lines           []
go_highlight_types    #1
gruvbox_underline     #1
ft_ignore_pat          \.\(Z\|gz\|bz2\|zip\|tgz\)$
b:changedtick         #3
b:did_autoload_ultisnips_map_keys #1
b:did_after_plugin_ultisnips_after #1
w:airline_lastmode     normal
w:airline_active      #1
w:airline_current_mode  NORMAL
v:beval_winid         #0
v:version             #801
v:t_list              #3
v:beval_winnr         #0
v:errors              []
v:lnum                #0
v:hlsearch            #0
v:t_channel           #9
v:scrollstart          command line line 0
v:dying               #0
v:windowid            #58720259
v:mouse_winid         #0
v:lang                 en_US.UTF-8
v:t_none              #7
v:count               #0
v:progpath             /usr/bin/vim.gtk3
v:true                 v:true
v:t_string            #1
v:none                 v:none
v:progname             vim
v:t_bool              #6
v:t_number            #0
v:vim_did_enter       #0
v:cmdbang             #0
dying               #0
v:windowid            #58720259
v:mouse_winid         #0
v:lang                 en_US.UTF-8
v:t_none              #7
v:count               #0
v:progpath             /usr/bin/vim.gtk3
v:true                 v:true
v:t_string            #1
v:none                 v:none
v:progname             vim
v:t_bool              #6
v:t_number            #0
v:vim_did_enter       #0
v:cmdbang             #0
v:foldlevel           #0
v:t_func              #2
v:ctype                en_US.UTF-8
v:t_job               #8
v:prevcount           #0
v:register             "
v:mouse_win           #0
v:count1              #0
v:foldstart           #0
v:foldend             #0
v:profiling           #0
v:t_float             #5
v:null                 v:null
v:beval_col           #0
v:beval_lnum          #0
v:mouse_lnum          #0
v:completed_item      {}
v:t_dict              #4
v:false                v:false
v:beval_bufnr         #0
v:shell_error         #0
v:testing             #0
v:lc_time              cs_CZ.UTF-8
v:searchforward       #1
v:event               {}
v:mouse_col           #0
v:statusmsg            No matching autocommands
msvitok77 commented 5 years ago

The minimal program which causes the problem is this:

package main

import (
    "fmt"

    "go.uber.org/zap"
    "google.golang.org/grpc"
)

type Producer struct {
    lg   *zap.SugaredLogger
    conn *grpc.ClientConn
}

func main() {
    fmt.Println("test")
}

Please note that the code is located outside of GOPATH as I'm using go modules and I have export GO111MODULE=on in my .profile to reproduce it, just open it in vim and :7 jkjkjk

Here is the screenshot: https://ibb.co/xzt9tPJ

dambrisco commented 5 years ago

Getting the same error when hovering over package references in code. For example in the following code block, the error would be triggered when hovering on packets in the line packets.NewPacket(). This only happens with non-stdlib imports (e.g. fmt doesn't cause it). And I'm also using go modules.

package main

import (
    "github.com/example/example/pkg/packets"
)

func main() {
    packets.NewPacket()
}
bhcleek commented 5 years ago

I've pushed workaround to master, but I don't really consider this issue fixed. The info you've provided will be enough for me to figure out what's going on.

bhcleek commented 5 years ago

@yshadow I apologize, but that wasn't the output I need. You'll need to quote that argument to -c thusly: -c "let g:go_debug=['lsp']".

bhcleek commented 5 years ago

The only way I can duplicate these errors is if there package being hovered over is not in the module cache and can't be found by gopls either. That would cover your use case @dambrisco . What about yours @yshadow ?

If that is in fact the problem, then the fix is already on master.

msvitok77 commented 5 years ago

Hello @bhcleek I pulled the latest master and the fix worked. Good job! Thanks.

msvitok77 commented 5 years ago

@yshadow I apologize, but that wasn't the output I need. You'll need to quote that argument to -c thusly: -c "let g:go_debug=['lsp']".

thanks for this instruction. It's really interesting to see the inner working of this plugin. Cheers

invine commented 5 years ago

Issue is fixed for me as well.

Just in case if you're still interested in gopls output:

Here's my file's imports:

package main

import (
    "context"
    "fmt"
    "log"
    "net/http"
    "path/filepath"'

    "github.com/google/uuid"
    "github.com/invine/jobq/api"
    "github.com/invine/jobq/pkg/agent"
    "github.com/invine/jobq/pkg/config"
    "github.com/invine/jobq/pkg/functions"
    "github.com/invine/jobq/pkg/redis"
    "github.com/invine/jobq/pkg/storage"
)

gopls output for hovering over "fmt" package:

received: Content-Length: 644
�
�{"jsonrpc":"2.0","result":{"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{}},"hoverProvider":true,"completionProvider":{"triggerCharacters":["."]},"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":true,"documentFormattingProvider":true,"renameProvider":true,"documentLinkProvider":{},"typeDefinitionProvider":true,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":"workspace/didChangeWorkspaceFolders"}},"foldingRangeProvider":true},"custom":null},"id":1}
sent: Content-Length: 57
�
�{"method": "initialized", "jsonrpc": "2.0", "params": {}}
sent: Content-Length: 1574
�
�{"method": "textDocument/didOpen", "jsonrpc": "2.0", "params": {"textDocument": {"uri": "file:///home/invine/go/src/github.com/invine/jobq/main.go", "languageId": "go", "text": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n\t\"path/filepath\"\n\n\t\"github.com/google/uuid\"\n\t\"github.com/invine/jobq/api\"\n\t\"github.com/invine/jobq/pkg/agent\"\n\t\"github.com/invine/jobq/pkg/config\"\n\t\"github.com/invine/jobq/pkg/functions\"\n\t\"github.com/invine/jobq/pkg/redis\"\n\t\"github.com/invine/jobq/pkg/storage\"\n)\n\nfunc main() {\n\tp, err := filepath.Abs(\"config.toml\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tconfig, err := config.FromFile(p)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\trcl, err := redis.NewClient(config)\n\tif err != nil {\n\t\tlog.Fatalf(\"can't start Redis: %v\", err)\n\t}\n\tcmdC := rcl.Sub(\"commands\")\n\tdb := &storage.PsqlDB{}\n\tif err := db.Open(config); err != nil {\n\t\tlog.Fatalf(\"can't start DB: %v\", err)\n\t}\n\tfuncs := map[string]functions.Function{\n\t\t\"hash\":  functions.CrackHash(),\n\t\t\"sleep\": functions.Sleep(),\n\t}\n\ta := &agent.Agent{\n\t\tCmdC:  cmdC,\n\t\tDB:    db,\n\t\tFuncs: funcs,\n\t}\n\ts := api.NewServer(\n\t\thttp.NewServeMux(),\n\t\trcl,\n\t\tfunc(ctx context.Context, id string) (interface{}, error) {\n\t\t\tUUID, err := uuid.Parse(id)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"getTask: can't parse ID: %v\", err)\n\t\t\t}\n\t\t\treturn db.Read(UUID)\n\t\t},\n\t\t\"localhost:8080\",\n\t)\n\tgo a.Run()\n\tlog.Fatal(s.Run())\n}\n"}}}
received: Content-Length: 268
�
�{"jsonrpc":"2.0","method":"client/registerCapability","params":{"registrations":[{"id":"workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"},{"id":"workspace/didChangeWorkspaceFolders","method":"workspace/didChangeWorkspaceFolders"}]},"id":1}
sent: Content-Length: 43
�
�{"id": 1, "jsonrpc": "2.0", "result": null}
received: Content-Length: 289
�
�{"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///home/invine/go/src/github.com/invine/jobq","section":"gopls"},{"scopeUri":"file:///home/invine/go/src/github.com/invine/jobq","section":"gopls-/home/invine/go/src/github.com/invine/jobq"}]},"id":2}
sent: Content-Length: 143
�
�{"id": 2, "jsonrpc": "2.0", "result": [{"buildFlags": [], "hoverKind": "NoDocumentation"}, {"buildFlags": [], "hoverKind": "NoDocumentation"}]}
received: Content-Length: 1494
�
�{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/09/27 09:53:24 Build info\n----------\ngolang.org/x/tools/gopls v0.1.7\n    golang.org/x/tools/gopls@v0.1.7 h1:YwKf8t9h69++qCtVmc2q6fVuetFXmmu9LKoPMYLZid4=\n    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=\n    golang.org/x/tools@v0.0.0-20190918214516-5a1a30219888 h1:ER45Jz0UDQ3e6em1lwXVwuPf96lvyQogb7m+gEbsoPg=\n    golang.org/x/xerrors@v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=\n\nGo info\n-------\ngo version go1.13 linux/amd64\n\nGO111MODULE=\"\"\nGOARCH=\"amd64\"\nGOBIN=\"/home/invine/go/bin\"\nGOCACHE=\"/home/invine/.cache/go-build\"\nGOENV=\"/home/invine/.config/go/env\"\nGOEXE=\"\"\nGOFLAGS=\"\"\nGOHOSTARCH=\"amd64\"\nGOHOSTOS=\"linux\"\nGONOPROXY=\"\"\nGONOSUMDB=\"\"\nGOOS=\"linux\"\nGOPATH=\"/home/invine/go\"\nGOPRIVATE=\"\"\nGOPROXY=\"https://proxy.golang.org,direct\"\nGOROOT=\"/usr/lib/go\"\nGOSUMDB=\"sum.golang.org\"\nGOTMPDIR=\"\"\nGOTOOLDIR=\"/usr/lib/go/pkg/tool/linux_amd64\"\nGCCGO=\"gccgo\"\nAR=\"ar\"\nCC=\"gcc\"\nCXX=\"g++\"\nCGO_ENABLED=\"1\"\nGOMOD=\"/home/invine/go/src/github.com/invine/jobq/go.mod\"\nCGO_CFLAGS=\"-g -O2\"\nCGO_CPPFLAGS=\"\"\nCGO_CXXFLAGS=\"-g -O2\"\nCGO_FFLAGS=\"-g -O2\"\nCGO_LDFLAGS=\"-g -O2\"\nPKG_CONFIG=\"pkg-config\"\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build898782976=/tmp/go-build -gno-record-gcc-switches\"\n"}}
received: Content-Length: 262
�
�{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/09/27 09:53:24 23.346113ms for GOROOT= GOPATH=/home/invine/go GO111MODULE= PWD=/home/invine/go/src/github.com/invine/jobq go \"env\" \"GOMOD\", stderr: \u003c\u003c\u003e\u003e\n"}}
received: Content-Length: 372
�
�{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/09/27 09:53:24 65.164327ms for GOROOT= GOPATH=/home/invine/go GO111MODULE= PWD=/home/invine/go/src/github.com/invine/jobq go \"list\" \"-e\" \"-json\" \"-compiled=true\" \"-test=true\" \"-export=false\" \"-deps=true\" \"-find=false\" \"--\" \"builtin\", stderr: \u003c\u003c\u003e\u003e\n"}}
received: Content-Length: 262
�
�{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/09/27 09:53:24 26.619031ms for GOROOT= GOPATH=/home/invine/go GO111MODULE= PWD=/home/invine/go/src/github.com/invine/jobq go \"env\" \"GOMOD\", stderr: \u003c\u003c\u003e\u003e\n"}}
received: Content-Length: 279
�
�{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/09/27 09:53:24 135.456255ms for GOROOT= GOPATH=/home/invine/go GO111MODULE= PWD=/home/invine/go/src/github.com/invine/jobq go \"list\" \"-m\" \"-json\" \"all\", stderr: \u003c\u003c\u003e\u003e\n"}}
received: Content-Length: 279
�
�{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/09/27 09:53:25 159.164142ms for GOROOT= GOPATH=/home/invine/go GO111MODULE= PWD=/home/invine/go/src/github.com/invine/jobq go \"list\" \"-m\" \"-json\" \"all\", stderr: \u003c\u003c\u003e\u003e\n"}}
received: Content-Length: 407
�
�{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/09/27 09:53:25 444.89393ms for GOROOT= GOPATH=/home/invine/go GO111MODULE= PWD=/home/invine/go/src/github.com/invine/jobq go \"list\" \"-e\" \"-json\" \"-compiled=true\" \"-test=true\" \"-export=false\" \"-deps=true\" \"-find=false\" \"--\" \"/home/invine/go/src/github.com/invine/jobq\", stderr: \u003c\u003c\u003e\u003e\n"}}
received: Content-Length: 131
�
�{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/09/27 09:53:25 go/packages.Load\n\tpackages = 1"}}
received: Content-Length: 215
�
�{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/09/27 09:53:25 go/packages.Load\n\tpackage = github.com/invine/jobq\n\tfiles = [/home/invine/go/src/github.com/invine/jobq/main.go]"}}
sent: Content-Length: 1578
�
�{"method": "textDocument/didChange", "jsonrpc": "2.0", "params": {"contentChanges": [{"text": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n\t\"path/filepath\"\n\n\t\"github.com/google/uuid\"\n\t\"github.com/invine/jobq/api\"\n\t\"github.com/invine/jobq/pkg/agent\"\n\t\"github.com/invine/jobq/pkg/config\"\n\t\"github.com/invine/jobq/pkg/functions\"\n\t\"github.com/invine/jobq/pkg/redis\"\n\t\"github.com/invine/jobq/pkg/storage\"\n)\n\nfunc main() {\n\tp, err := filepath.Abs(\"config.toml\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tconfig, err := config.FromFile(p)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\trcl, err := redis.NewClient(config)\n\tif err != nil {\n\t\tlog.Fatalf(\"can't start Redis: %v\", err)\n\t}\n\tcmdC := rcl.Sub(\"commands\")\n\tdb := &storage.PsqlDB{}\n\tif err := db.Open(config); err != nil {\n\t\tlog.Fatalf(\"can't start DB: %v\", err)\n\t}\n\tfuncs := map[string]functions.Function{\n\t\t\"hash\":  functions.CrackHash(),\n\t\t\"sleep\": functions.Sleep(),\n\t}\n\ta := &agent.Agent{\n\t\tCmdC:  cmdC,\n\t\tDB:    db,\n\t\tFuncs: funcs,\n\t}\n\ts := api.NewServer(\n\t\thttp.NewServeMux(),\n\t\trcl,\n\t\tfunc(ctx context.Context, id string) (interface{}, error) {\n\t\t\tUUID, err := uuid.Parse(id)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"getTask: can't parse ID: %v\", err)\n\t\t\t}\n\t\t\treturn db.Read(UUID)\n\t\t},\n\t\t\"localhost:8080\",\n\t)\n\tgo a.Run()\n\tlog.Fatal(s.Run())\n}\n"}], "textDocument": {"uri": "file:///home/invine/go/src/github.com/invine/jobq/main.go"}}}
sent: Content-Length: 203
�
�{"method": "textDocument/definition", "jsonrpc": "2.0", "id": 2, "params": {"textDocument": {"uri": "file:///home/invine/go/src/github.com/invine/jobq/main.go"}, "position": {"character": 6, "line": 4}}}
received: Content-Length: 158
�
�{"jsonrpc":"2.0","result":[{"uri":"file:///usr/lib/go/src/fmt/scan.go","range":{"start":{"line":4,"character":0},"end":{"line":1171,"character":82}}}],"id":2}
sent: Content-Length: 175
�
�{"method": "textDocument/hover", "jsonrpc": "2.0", "id": 3, "params": {"textDocument": {"uri": "file:///usr/lib/go/src/fmt/scan.go"}, "position": {"character": 0, "line": 4}}}
received: Content-Length: 154
�
�{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/invine/go/src/github.com/invine/jobq/main.go","diagnostics":[]}}
received: Content-Length: 38
�
�{"jsonrpc":"2.0","result":null,"id":3}