fatih / vim-go

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

vim-go: failed to sync breakpoints #3659

Open jmastr opened 5 months ago

jmastr commented 5 months ago

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

package main

import (
        "fmt"
        "time"
)

func main() {
        now := time.Now()
        fmt.Println(now)
}
  1. Put cursor to line 9 and :GoDebugStart
  2. :GoDebugContinue
  3. :GoDebugStep

It takes exactly 20 seconds until debug step is complete and nvim is usable again.

Note: this does NOT happen with vim, but only with NeoVIM.

What did you expect to happen?

What happened instead?

vim-go ran in a 20 seconds RPC timeout from here: https://github.com/fatih/vim-go/blob/feef9b31507f8e942bcd21f9e1f22d587c83c72d/autoload/go/debug.vim#L653 as you can see at the time stamps below:

ERR: 2024-04-16T12:04:07+02:00 debug layer=rpc -> *rpc2.ListBreakpointsOut{"Breakpoints":[{"id":-1,"name":"unrecovered-panic","addr":4445380,"addrs":[4445380],"addrpid":[253150],"file":"/nix/store/fqzds43dcw7164rm1h51n54l2ipxi1qj-go-
ERR: 2024-04-16T12:04:27+02:00 debug layer=rpc <- RPCServer.LastModified(rpc2.LastModifiedIn{})
...
vim-go: failed to sync breakpoints (function <SNR>115_on_data[27]..<SNR>115_handleRPCResult[7]..<SNR>115_handle...int[27]..<SNR>115_sync_breakpoints, line 9): Vim(let):E716: Key not present in Dictionary: "result.Breakpoints"

Configuration (MUST fill this out):

vim-go version: 2024-03-25 / 14eedf6135cf4253b0ed48a0b53d6834a40da1c4

vimrc you used to reproduce:

vimrc ```vim let g:ycm_gopls_binary_path='gopls' let g:ycm_max_num_candidates = 0 let g:go_fmt_command = "goimports" let g:go_metalinter_autosave = 1 let g:go_debug_preserve_layout = 1 let g:go_debug_windows = { \ 'vars': 'rightbelow 61vnew', \ 'stack': 'rightbelow 21new', \ 'out': 'botright 15new', \ } let g:go_debug_mappings = { \ '(go-debug-breakpoint)': {'key': 'b'}, \ '(go-debug-continue)': {'key': 'c'}, \ '(go-debug-next)': {'key': 'n'}, \ '(go-debug-print)': {'key': 'p'}, \ '(go-debug-step)': {'key': 's'}, \ } ```

Vim version (first three lines from :version):

NVIM v0.9.4 Build type: Release LuaJIT 2.1.1693350652

Go version (go version):

go version go1.21.9 linux/amd64

Go environment

go env Output:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/julian/.cache/go-build'
GOENV='/home/julian/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/julian/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/julian/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/nix/store/fqzds43dcw7164rm1h51n54l2ipxi1qj-go-1.21.9/share/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/nix/store/fqzds43dcw7164rm1h51n54l2ipxi1qj-go-1.21.9/share/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.9'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/nix/store/fqzds43dcw7164rm1h51n54l2ipxi1qj-go-1.21.9/share/go/src/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2252756228=/tmp/go-build -gno-record-gcc-switches'

gopls version

gopls version Output:

golang.org/x/tools/gopls v0.15.2

vim-go configuration:

vim-go configuration
g:go_loaded_gosnippets = 1
g:go_debug_preserve_layout = 1
g:go_debug_mappings = {'(go-debug-step)': {'key': 's'}, '(go-debug-print)': {'key': 'p'}, '(go-debug-next)': {'key': 'n'}, '(go-debug-continue)': {'key': 'c'}, '(go-debug-breakpoint)': {'key': 'b'}}
g:go_debug_windows = {'vars': 'rightbelow 61vnew', 'out': 'botright 15new', 'stack': 'rightbelow 21new'}
g:go_metalinter_autosave = 1
g:go_fmt_command = 'goimports'
g:go_jump_to_error = 1
g:go_loaded_install = 1

filetype detection configuration:

filetype detection
filetype detection:ON  plugin:ON  indent:ON
yuch3ng commented 2 months ago

This happens to me too(NVIM v0.6.1), somehow it can still run, but stepinto is extremely slow, sometime with same error message. Works perfectly in vim(VIM - Vi IMproved 8.2) though

bhcleek commented 2 months ago

The 20 seconds is a good clue that vim-go is having a hard time processing the response. Perhaps something is amiss with the buffer handling that vim-go uses for neovim.