Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Staging full buffer with gitsigns hS yields in coroutine failure due to accessing nil value #528

Open
matu3ba opened this issue Aug 31, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@matu3ba
Copy link

matu3ba commented Aug 31, 2024

Description

Functionality remains, its just abit annoying to have these popup mesages:

Error executing vim.schedule lua callback: ...ocal/nvim-data/lazy/diffview.nvim/lua/diffview/async.lua:187: The coroutine failed with this message:
        context: cur_thread=main co_thread=<thread 0x026bce051d78> co_func=...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:327
...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:397: attempt to index a nil value
stack traceback:
        ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua: in function 'func'
        ...ocal/nvim-data/lazy/diffview.nvim/lua/diffview/async.lua:373: in function <...ocal/nvim-data/lazy/diffview.nvim/lua/diffview/async.lua:358>
stack traceback:
        [C]: in function 'error'
        ...ocal/nvim-data/lazy/diffview.nvim/lua/diffview/async.lua:187: in function 'raise'
        ...ocal/nvim-data/lazy/diffview.nvim/lua/diffview/async.lua:215: in function 'step'
        ...ocal/nvim-data/lazy/diffview.nvim/lua/diffview/async.lua:247: in function 'notify_all'
        ...ocal/nvim-data/lazy/diffview.nvim/lua/diffview/async.lua:222: in function 'step'
        ...ocal/nvim-data/lazy/diffview.nvim/lua/diffview/async.lua:399: in function <...ocal/nvim-data/lazy/diffview.nvim/lua/diffview/async.lua:391>

Expected behavior

No pop-up messages.

Actual behavior

Pop-up messages on staging the last file of a dir.

Steps to reproduce

nvim
:DiffViewOpen --imply-local=true
go to right window
stage, for example via :Gitsigns stage_buffer

Health check

Output of :checkhealth diffview

==============================================================================
dap: require("dap.health").check()

dap: Adapters ~

dap: Sessions ~
- OK No active sessions

==============================================================================
diffview: require("diffview.health").check()

Checking plugin dependencies ~
- WARNING Optional dependency 'nvim-web-devicons' not found.

Checking VCS tools ~
- The plugin requires at least one of the supported VCS tools to be valid.
- OK Git found.
- OK Git is up-to-date. (2.46.0.windows.1)
- WARNING Configured `hg_cmd` is not executable: 'hg'

==============================================================================
hydra: require("hydra.health").check()

Hydra: Checking settings ~
- OK             `timeoutlen` (value: 1000) is set to a good value.
          

==============================================================================
lazy: require("lazy.health").check()

lazy.nvim ~
- {lazy.nvim} version `11.14.1`
- OK {git} `version 2.46.0.windows.1`
- OK no existing packages found by other package managers
- OK packer_compiled.lua not found

luarocks ~
- OK luarocks disabled

==============================================================================
mason: require("mason.health").check()

mason.nvim ~
- OK mason.nvim version v1.10.0
- OK PATH: prepend
- OK Providers: 
    mason.providers.registry-api
    mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2024-08-05-plucky-object` is installed.

mason.nvim [Core utils] ~
- WARNING unzip: not available
  - ADVICE:
    - spawn: unzip failed with exit code - and signal -. unzip is not executable
- WARNING wget: not available
  - ADVICE:
    - spawn: wget failed with exit code - and signal -. wget is not executable
- OK curl: `curl 8.7.1 (Windows) libcurl/8.7.1 Schannel zlib/1.3 WinIDN
`
- WARNING gzip: not available
  - ADVICE:
    - spawn: gzip failed with exit code - and signal -. gzip is not executable
- OK tar: `bsdtar 3.5.2 - libarchive 3.5.2 zlib/1.2.5.f-ipp 
`
- OK pwsh: `7.4.5 Microsoft Windows 10.0.19045 Win32NT
`
- OK 7z: `7-Zip 23.01 (x64) : Copyright (c) 1999-2023 Igor Pavlov : 2023-06-20
`

mason.nvim [Languages] ~
- WARNING Go: not available
  - ADVICE:
    - spawn: go failed with exit code - and signal -. go is not executable
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer.bat failed with exit code - and signal -. composer.bat is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- WARNING luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- WARNING Ruby: not available
  - ADVICE:
    - spawn: ruby failed with exit code - and signal -. ruby is not executable
- WARNING javac: not available
  - ADVICE:
    - spawn: javac failed with exit code - and signal -. javac is not executable
- WARNING java: not available
  - ADVICE:
    - spawn: java failed with exit code - and signal -. java is not executable
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- WARNING RubyGem: not available
  - ADVICE:
    - spawn: gem.cmd failed with exit code - and signal -. gem.cmd is not executable
- OK cargo: `cargo 1.77.1 (e52e36006 2024-03-26)`
- OK node: `v14.15.5
`
- OK python: `Python 3.12.0
`
- WARNING npm: unsupported version `6.14.11`
  - ADVICE:
    - npm version must be >= 7
- OK pip: `pip 24.0 from C:\Users\hafer\AppData\Roaming\Python\Python312\site-packages\pip (python 3.12)

`
- OK python venv: `Ok`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: 31.08.2024 23:50:26.
  Install and authenticate via gh-cli to increase rate limit.

==============================================================================
telescope: health#telescope#check

Checking for required plugins ~
- OK plenary installed.
- WARNING nvim-treesitter not found. (Required for `:Telescope treesitter`.)

Checking external dependencies ~
- OK rg: found ripgrep 13.0.0
- OK fd: found fd 8.7.1

===== Installed extensions ===== ~

Telescope Extension: `zf-native` ~
- No healthcheck provided

==============================================================================
vim.deprecated: require("vim.deprecated.health").check()

- OK No deprecated functions detected

==============================================================================
vim.health: require("vim.health.health").check()

Configuration ~
- OK no issues found

Runtime ~
- OK $VIMRUNTIME: C:\Program Files\Neovim\share/nvim/runtime

Performance ~
- OK Build type: RelWithDebInfo

Remote Plugins ~
- OK Up to date

External Tools ~
- OK ripgrep 13.0.0 (C:\Users\hafer\.cargo\bin\rg.EXE)

==============================================================================
vim.lsp: require("vim.lsp.health").check()

- LSP log level : WARN
- Log path: C:\Users\hafer\AppData\Local\nvim-data/lsp.log
- WARNING Log size: 327230 KB

vim.lsp: Active Clients ~
- clangd (id: 1)
    Root directory: ~\pix\PxApplication
    Command: C:\Program Files\LLVM\bin\clangd.EXE
    Settings: vim.empty_dict()
    Attached buffers: 16, 19, 21, 23, 26, 28, 31, 34, 36, 39, 41, 44, 49, 52, 55, 61, 64, 70, 75, 72

vim.lsp: File Watcher ~
- file watching "(workspace/didChangeWatchedFiles)" disabled on all clients

vim.lsp: Position Encodings ~
- No buffers contain mixed position encodings

==============================================================================
vim.provider: require("vim.provider.health").check()

Clipboard (optional) ~
- OK Clipboard tool found: win32yank

Node.js provider (optional) ~
- Disabled (loaded_node_provider=0).

Perl provider (optional) ~
- Disabled (loaded_perl_provider=0).

Python 3 provider (optional) ~
- Disabled (loaded_python3_provider=0).

Ruby provider (optional) ~
- Disabled (loaded_ruby_provider=0).

==============================================================================
vim.treesitter: require("vim.treesitter.health").check()

- Nvim runtime ABI version: 14
- OK Parser: bash                 ABI: 14, path: C:\Program Files\Neovim\lib\nvim\parser\bash.dll
- OK Parser: c                    ABI: 14, path: C:\Program Files\Neovim\lib\nvim\parser\c.dll
- OK Parser: lua                  ABI: 14, path: C:\Program Files\Neovim\lib\nvim\parser\lua.dll
- OK Parser: markdown             ABI: 14, path: C:\Program Files\Neovim\lib\nvim\parser\markdown.dll
- OK Parser: markdown_inline      ABI: 14, path: C:\Program Files\Neovim\lib\nvim\parser\markdown_inline.dll
- OK Parser: python               ABI: 14, path: C:\Program Files\Neovim\lib\nvim\parser\python.dll
- OK Parser: query                ABI: 14, path: C:\Program Files\Neovim\lib\nvim\parser\query.dll
- OK Parser: vim                  ABI: 14, path: C:\Program Files\Neovim\lib\nvim\parser\vim.dll
- OK Parser: vimdoc               ABI: 14, path: C:\Program Files\Neovim\lib\nvim\parser\vimdoc.dll

==============================================================================
which-key: require("which-key.health").check()

- OK Most of these checks are for informational purposes only.
  WARNINGS should be treated as a warning, and don't necessarily indicate a problem with your config.
  Please |DON't| report these warnings as an issue.

Checking your config ~
- WARNING |mini.icons| is not installed
- WARNING |nvim-web-devicons| is not installed
- WARNING Keymap icon support will be limited.

Checking for issues with your mappings ~
- OK No issues reported

checking for overlapping keymaps ~
- WARNING In mode `n`, <gc> overlaps with <gcc>:
  - <gc>: Toggle comment
  - <gcc>: Toggle comment line
- WARNING In mode `n`, <yS> overlaps with <ySS>:
  - <yS>: Add a surrounding pair around a motion, on new lines (normal mode)
  - <ySS>: Add a surrounding pair around the current line, on new lines (normal mode)
- WARNING In mode `n`, <ys> overlaps with <yss>:
  - <ys>: Add a surrounding pair around a motion (normal mode)
  - <yss>: Add a surrounding pair around the current line (normal mode)
- WARNING In mode `n`, <;t> overlaps with <;t5>, <;t4>, <;t3>, <;t2>, <;t1>, <;t9>, <;t8>, <;t7>, <;t6>:
  - <;t5>: Open output tab task #5
  - <;t4>: Open output tab task #4
  - <;t3>: Open output tab task #3
  - <;t2>: Open output tab task #2
  - <;t1>: Open output tab task #1
  - <;t9>: Open output tab task #9
  - <;t8>: Open output tab task #8
  - <;t7>: Open output tab task #7
  - <;t6>: Open output tab task #6
- WARNING In mode `x`, <a> overlaps with <al>, <ai>, <a%>, <an>:
  - <a>: Around textobject
  - <al>: Around last textobject
  - <ai>: Object scope with border
  - <an>: Around next textobject
- WARNING In mode `x`, <i> overlaps with <ii>, <il>, <in>:
  - <i>: Inside textobject
  - <ii>: Object scope
  - <il>: Inside last textobject
  - <in>: Inside next textobject
- WARNING In mode `o`, <i> overlaps with <ii>, <il>, <in>:
  - <i>: Inside textobject
  - <ii>: Object scope
  - <il>: Inside last textobject
  - <in>: Inside next textobject
- WARNING In mode `o`, <a> overlaps with <ai>, <al>, <an>:
  - <a>: Around textobject
  - <ai>: Object scope with border
  - <al>: Around last textobject
  - <an>: Around next textobject
- WARNING In mode `n`, <<Space>e> overlaps with <<Space>ex>:
  - <<Space>e>: Bring focus to the file panel
- WARNING In mode `n`, <<Space>b> overlaps with <<Space>b1>, <<Space>bb>:
  - <<Space>b>: Toggle the file panel
- OK Overlapping keymaps are only reported for informational purposes.
  This doesn't necessarily mean there is a problem with your config.

Checking for duplicate mappings ~
- OK No duplicate mappings found

==============================================================================
zf-native: require("zf-native.health").check()

Installation ~
- libzf library path: C:/Users/hafer/AppData/Local/nvim-data/lazy/telescope-zf-native.nvim/lua/../lib/libzf-windows-x64.dll
- OK libzf path is valid

Configuration
  - zf telescope file sorter enabled
    - highlights: true
    - filename score priority: true
  - zf telescope generic sorter enabled
    - highlights: true
    - filename score priority: false ~

Log info

Relevant info from :DiffviewLog
############################
### PUT LOG CONTENT HERE ###
############################

Neovim version

NVIM v0.11.0-dev-616+gfd65422b9
Build type: RelWithDebInfo
LuaJIT 2.1.1723675123
Compilation: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe /DWIN32 /D_WINDOWS /MD /Zi /O2 /Ob1 /GL -W3 -wd4311 -wd4146 -wd4003 -wd4715  -DUNIT_TESTING -DHAVE_UNIBILIUM -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_WIN32_WINNT=0x0602 -DMSWIN -DINCLUDE_GENERATED_DECLARATIONS -DUTF8PROC_STATIC -ID:/a/neovim/neovim/.deps/usr/include/luajit-2.1 -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/build/src/nvim/auto -ID:/a/neovim/neovim/build/include -ID:/a/neovim/neovim/build/cmake.config -ID:/a/neovim/neovim/src

          System-vimrc-Datei: "$VIM/sysinit.vim"
     Voreinstellung für $VIM: "C:/Program Files (x86)/nvim/share/nvim"

Run :checkhealth for more info

Operating system and version

MINGW64_NT-10.0-19045 3.4.10-2e2ef940.x86_64 x86_64 Msys

Minimal config

-- #######################################
-- ### USAGE: nvim --clean -u mini.lua ###
-- #######################################

local root = vim.fn.stdpath("run") .. "/nvim/diffview.nvim"
local plugin_dir = root .. "/plugins"
vim.fn.mkdir(plugin_dir, "p")

for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

local plugins = {
  { "nvim-web-devicons", url = "https://github.com/nvim-tree/nvim-web-devicons.git" },
  { "diffview.nvim", url = "https://github.com/sindrets/diffview.nvim.git" },
  { "gitsigns.nvim", url = "https://github.com/lewis6991/gitsigns.nvim.git"
}

for _, spec in ipairs(plugins) do
  local install_path = plugin_dir .. "/" .. spec[1]
  if vim.fn.isdirectory(install_path) ~= 1 then
    if spec.url then
      print(string.format("Installing '%s'...", spec[1]))
      vim.fn.system({ "git", "clone", "--depth=1", spec.url, install_path })
    end
  end
  vim.opt.runtimepath:append(spec.path or install_path)
end

require("diffview").setup({
  -- ##############################################################################
  -- ### ADD DIFFVIEW.NVIM CONFIG THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE ###
  -- ##############################################################################
})

vim.opt.termguicolors = true
vim.cmd("colorscheme " .. (vim.fn.has("nvim-0.8") == 1 and "habamax" or "slate"))

local function map(mode, l, r, opts)
  opts = opts or {}
  opts.buffer = bufnr
  vim.keymap.set(mode, l, r, opts)
end
map('n', '<leader>hS', gs.stage_buffer, { desc = 'Stage buffer' })

require('gitsigns').setup()
print("Ready!")
@matu3ba matu3ba added the bug Something isn't working label Aug 31, 2024
@matu3ba
Copy link
Author

matu3ba commented Aug 31, 2024

The log shows nothing relevant and the stack trace info should be sufficient for the fix.

I can recomment the toggle word feature of gitsigns and would love to see external diff providers.
diffview makes stuff relative convenient to navigate, although the default M prefix makes it slower than necessary when picking a bunch of files.

Is there an API to 1. do stuff with the file view window, 2. cycling through commits per file and 3. cycling through commits?
Most common ones are probably reviewing additional fixes on top of a commit and having custom keybindings would be very convenient.

@matu3ba matu3ba changed the title [Bug] Staging full buffer with gitsigns gS yields in coroutine failure due to accessing nil value [Bug] Staging full buffer with gitsigns hS yields in coroutine failure due to accessing nil value Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant