Closed CalebLarsen closed 5 years ago
The default for g:go_def_mode
is gopls
, which requires that the file is on disk, so just save the file before trying to jump to a definition.
This will be remedied in a future version of gopls
.
Alternatively, if you're in GOPATH mode, then you can set g:go_def_mode
to godef
or guru
.
Same problem, using godef can solve this. But it's much more slower when jumping.
What did you do? (required: The issue will be closed when not provided)
Frequently I will make a new go file or read somebody else's code, and then attempt to use :GoDef on functions and have the function fail. The error I get is that there is no AST for that file. I've tried to search how to resolve this issue and have not found any resolutions (although I found another soul on reddit had similar issues).
Try creating new files, or copy a file from Github and immediately running :GoDef
What did you expect to happen?
I expected to see the function definition
What happened instead?
I received an error of "vim-go: no AST for file:///path/to/file.go"
Configuration (MUST fill this out):
Vim in Tmux using Alacritty (I hope this is what you are wanting here)
vim-go version:
Latest (Updated to latest using vim plugged)
vimrc
you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc):vimrc
Vim version (first three lines from
:version
):VIM - Vi IMproved 8.1 (2018 May 18, compiled Sep 3 2019 19:23:34) Included patches: 1-1968 Compiled by Arch Linux
Go version (
go version
):go version go1.13 linux/amd64
Go environment
go env
Output:vim-go configuration:
vim-go configuration