ray-x / go.nvim

G'day Nvimer, Joyful Gopher: Discover the Feature-Rich Go Plugin for Neovim
MIT License
2.12k stars 124 forks source link

Using `:GoDebug` command more than once results in error after first time #278

Closed clarkezone closed 1 year ago

clarkezone commented 1 year ago

OS:

➜  gotest lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy

Neovim Version

➜  gotest vim -version
NVIM v0.8.2
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-10 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/__w/neovim/neovim/build/cmake.config -I/__w/neovim/neovim/src -I/__w/neovim/neovim/.deps/usr/include -I/usr/include -I/__w/neovim/neovim/build/src/nvim/auto -I/__w/neovim/neovim/build/include
Compiled by root@4ae72dcad031

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info

Configuration:

https://github.com/clarkezone/neovimconfig

Repro steps:

  1. Install neovim
  2. Install golang
  3. Apply config from repo above (warning: this will nuke your current config):
    rm -rf ~/.config/nvim
    rm -rf ~/.local/share/nvim
    mkdir ~/.config/nvim
    git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
    git clone --depth 1 https://github.com/clarkezone/neovimconfig.git ~/.config/nvim
  4. Launch vim
  5. :PackerSync
  6. Quit and relanch
  7. :GoInstallBinaries
  8. Quit and relaunch
  9. Create a helloworld golang project:
    
    package main

import "fmt"

func main() {

    fmt.Println("Hello")

}

10. Attempt to debug the `main()` function first time (should work) `:GoDebug`
11. Press `S` to stop debugging
12. Attempt to debug second time `:GoDebug`

Result:

Error executing Lua callback: ...ck/packer/start/nvim-dap-ui/lua/dapui/windows/layout.lua:37: Invalid buffer id: 4 stack traceback: [C]: in function 'nvim_set_current_buf' ...ck/packer/start/nvim-dap-ui/lua/dapui/windows/layout.lua:37: in function 'open' ...im/site/pack/packer/start/nvim-dap-ui/lua/dapui/init.lua:354: in function 'cb' ...im/site/pack/packer/start/nvim-dap-ui/lua/dapui/init.lua:280: in function 'keep_cmdheight' ...im/site/pack/packer/start/nvim-dap-ui/lua/dapui/init.lua:332: in function 'open' ...share/nvim/site/pack/packer/start/go.nvim/lua/go/dap.lua:358: in function 'run' .../nvim/site/pack/packer/start/go.nvim/lua/go/commands.lua:62: in function <.../nvim/site/pack/packer/start/go.nvim/lua/go/commands.lua:57> Press ENTER or type command to continue

clarkezone commented 1 year ago

@Darkclainer any ideas (per other issue)

ray-x commented 1 year ago

Please use dapui with hash 6b6081ad244ae5aa1358775cc3c08502b04368f9 atm. There were some API changes from dapui on 26/Jan.

clarkezone commented 1 year ago

I couldn't find if it's possible to specify a commit hash via packer.use hence tried to do it manually but no dice:

nvim-dap-ui git:(master) pwd
/home/james/.local/share/nvim/site/pack/packer/start/nvim-dap-ui
➜  nvim-dap-ui git:(master) git show 6b6081ad244ae5aa1358775cc3c08502b04368f9
fatal: bad object 6b6081ad244ae5aa1358775cc3c08502b04368f9
➜  nvim-dap-ui git:(master)

Appols, I'm a Neovim nube at this point

ray-x commented 1 year ago

In fact, packer has a version field to specify the version to be installed. But I tried it today and this feature seems not working. Also packer may only truncate the version to the latest versions of the plugin. So one workaround is do a git clone of dapui into /home/james/.local/share/nvim/site/pack/packer/start/nvim-dap-ui folder manually. And check out the hash.

ray-x commented 1 year ago

FYI, please update the dap-ui to latest version. The issue was fixed in 3.2.3 version

clarkezone commented 1 year ago

Bingo.. that fixed it thanks!