Please complete these steps and check these boxes (by putting an x inside
the brackets) _before_ filing your issue:
vim --version.:YcmDebugInfo.:YcmToggleLogs command.install.py (or cmake/make/ninja) including its invocationThank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.
Provide a clear description of the problem, including the following key
questions:
Include steps to reproduce here.
main.go in gopathpackage main
import (
"go.uber.org/zap"
)
func main() {
logger, _ := zap.NewProduction()
defer logger.Sync()
logger.Info("haha")
}
run dep ensure -add "go.uber.org/zap"
use vim, open main.go, jump to line 11, under Info of logger.Info, and run :YcmCompleter GoTo,
got RuntimeError: Can't find a definition.
Include description of a minimal test case, including any actual code required
to reproduce the issue.
jump to definition of Info inner vendor directory.
Include description of the expected behaviour.
nothing but RuntimeError: Can't find a definition.
Include description of the observed behaviour, including actual output,
screenshots, etc.
vim --versionNVIM v0.2.2
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -O2 -fdebug-prefix-map=/build/neovim-OyJkBd/neovim-0.2.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DDISABLE_LOG -Wdate-time -D_FORTIFY_SOURCE=2 -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -O2 -g -DMIN_LOG_LEVEL=3 -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/build/neovim-OyJkBd/neovim-0.2.2/build/config -I/build/neovim-OyJkBd/neovim-0.2.2/src -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/build/neovim-OyJkBd/neovim-0.2.2/build/src/nvim/auto -I/build/neovim-OyJkBd/neovim-0.2.2/build/include
Compiled by [email protected]
Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
YcmDebugInfoPrinting YouCompleteMe debug information...
-- Client logfile: /tmp/ycm_k6wkcljd.log
-- Server Python interpreter: /home/jiajun/.py3k/bin/python
-- Server Python version: 3.6.3
-- Server has Clang support compiled in: False
-- Clang version: None
-- No extra configuration file found
-- Server running at: http://127.0.0.1:44727
-- Server process ID: 3464
-- Server logfiles:
-- /tmp/ycmd_44727_stdout_e296vmt2.log
-- /tmp/ycmd_44727_stderr_3hml12e5.log
Include link here to a gist containing the entire logfiles for ycm, ycmd
and any completer logfiles listed by:YcmToggleLogs.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux testing (buster)
Release: testing
Codename: buster
./install.py --go-completer
I can reproduce the issue and the ycmd logs show this error (godef is used to jump to definition):
RuntimeError: Command godef -i -f=main.go -json -o=126 failed with code 2 and error "godef: no declaration found for logger.Info".
Running directly the command with the latest version of godef raises the same error:
$ godef -i -f=main.go -o=126 < main.go
parseLocalPackage error: no more package files found
godef: no declaration found for logger.Info
so it looks like an issue with godef. Would you mind reporting it to the godef repository?
okay, thank you
Ran into the same issue today, found out that vim-go's :GoDef will work as expected, if you've installed the upstream godef into your $PATH.
ycmd uses a old fork of godef which doesn't really deal with golang vendor directories.
you can use vim-go's :GoDef if you want this fixed ugly and fast.
autocmd FileType go nnoremap <C-c>g :<C-u>call go#def#Jump("vsplit")<CR>
@jiajunhuang
@timfeirg Did you read my comment? I tried with the latest version of Godef. Are you sure you are talking about the same issue?
I'm sorry, I didn't exactly carry out the steps to verify that it's fixed.
I just put the example code in main.go, go get -d go.uber.org/zap, and then did a :GoDef on the logger.info method, this does work, so I just assumed that the latest version of the upstream godef works.
Also, I was seeing the upstream godef correctly finds the dependencies in the vendor directories, and just think that it's pretty convincing. @micbou
The :GoDef command from vim-go is working because it uses Guru by default, not Godef. I guess we should switch to that tool.
hello, after compile latest YCM with --go-completer, auto completion code in vendor still not work, will this issue be fixed? thank you!
using language server protocol now.
still not work, hope to be fixed
Can I configure ycm to use guru in Golang?
No
We have switched to gopls which solves the issue with the GoTo subcommand.
Most helpful comment
still not work, hope to be fixed