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

async lib update in c3070fc broke select_hunk #1223

Closed
mmirus opened this issue Feb 19, 2025 · 4 comments
Closed

async lib update in c3070fc broke select_hunk #1223

mmirus opened this issue Feb 19, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@mmirus
Copy link
Contributor

mmirus commented Feb 19, 2025

Description

After updating to c3070fc, select_hunk no longer works.

Neovim version

NVIM v0.10.2 Build type: Release LuaJIT 2.1.1713773202 Run "nvim -V1 -v" for more info

Operating system and version

NixOS 24.11

Expected behavior

Using a mapping that invokes select_hunk should work, e.g., vih should select the hunk.

Actual behavior

Nothing happens.

Minimal config

for name, url in pairs{
  gitsigns = 'https://github.com/lewis6991/gitsigns.nvim',
  -- ADD OTHER PLUGINS _NECESSARY_ TO REPRODUCE THE ISSUE
} do
local install_path = vim.fn.fnamemodify('gitsigns_issue/'..name, ':p')
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system { 'git', 'clone', '--depth=1', url, install_path }
end
vim.opt.runtimepath:append(install_path)
end

require('gitsigns').setup{
  debug_mode = true, -- You must add this to enable debug messages
  -- ADD GITSIGNS CONFIG THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE
  on_attach = function(bufnr)
    local gitsigns = require('gitsigns')

    local function map(mode, l, r, opts)
      opts = opts or {}
      opts.buffer = bufnr
      vim.keymap.set(mode, l, r, opts)
    end

    -- Text object
    map({'o', 'x'}, 'ih', gitsigns.select_hunk)
  end
}

-- ADD INIT.LUA SETTINGS THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE

Steps to reproduce

  1. mkdir gitsigns_issue
  2. cd gitsigns_issue
  3. git init
  4. touch file
  5. git add file
  6. git commit -m 'initial commit'
  7. nvim --clean -u minimal.lua file
  8. Edit the file to add a changed hunk
  9. Press vih with the cursor on the hunk

Gitsigns debug messages

E5108: Error executing lua: ...gns_issue/gitsigns_issue/gitsigns/lua/gitsigns/async.lua:99: timeout must be >= 0
stack traceback:
        [C]: in function 'wait'
        ...gns_issue/gitsigns_issue/gitsigns/lua/gitsigns/async.lua:99: in function 'pwait'
        ...gns_issue/gitsigns_issue/gitsigns/lua/gitsigns/async.lua:120: in function 'wait'
        ...s_issue/gitsigns_issue/gitsigns/lua/gitsigns/actions.lua:955: in function <...s_issue/gitsigns_issue/gitsigns/lua/gitsigns/actions.lua:946>

Gitsigns cache

@mmirus mmirus added the bug Something isn't working label Feb 19, 2025
@lewis6991
Copy link
Owner

Cannot reproduce on Nvim 0.10.2 or 0.9.5.

Can you check what happends when you run := vim.wait(math.huge, function() return true end)?

@lewis6991 lewis6991 added the unable to reproduce Unable to reproduce problem label Feb 20, 2025
@mmirus
Copy link
Contributor Author

mmirus commented Feb 20, 2025

Sure thing. Running := vim.wait(math.huge, function() return true end) produces the same error:

E5108: Error executing lua [string ":lua"]:1: timeout must be >= 0
stack traceback:
        [C]: in function 'wait'
        [string ":lua"]:1: in main chunk

Out of curiosity, I ran := vim.wait(1, function() return true end), and it does not error:

true
nil

I also tried :lua print(math.huge) and got:

inf

@lewis6991
Copy link
Owner

I just tried on Linux and can reproduce. I can't get this issue on MacOS.

@lewis6991 lewis6991 removed the unable to reproduce Unable to reproduce problem label Feb 20, 2025
@mmirus
Copy link
Contributor Author

mmirus commented Feb 20, 2025

Confirmed working now. Thanks as always!

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

2 participants