Skip to content

Commit

Permalink
fix: followup
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis6991 committed Apr 3, 2024
1 parent 4e90cf9 commit 690f298
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lua/gitsigns/async.lua
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,8 @@ end
--- able to call the API.
M.scheduler = M.wrap(1, vim.schedule)

function M.run(func, ...)
return run(func, nil, ...)
end

return M
9 changes: 6 additions & 3 deletions lua/gitsigns/diffthis.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ local throttle_by_id = require('gitsigns.debounce').throttle_by_id

local M = {}

--- @async
--- @param bufnr integer
--- @param dbufnr integer
--- @param base string?
local bufread = async.create(3, function(bufnr, dbufnr, base)
local function bufread(bufnr, dbufnr, base)
local bcache = cache[bufnr]
local comp_rev = bcache:get_compare_rev(util.calc_base(base))
local text --- @type string[]
Expand Down Expand Up @@ -42,7 +43,7 @@ local bufread = async.create(3, function(bufnr, dbufnr, base)

vim.bo[dbufnr].modifiable = modifiable
vim.bo[dbufnr].modified = false
end)
end

--- @param bufnr integer
--- @param dbufnr integer
Expand All @@ -64,6 +65,7 @@ local bufwrite = async.create(3, function(bufnr, dbufnr, base)
end
end)

--- @async
--- Create a gitsigns buffer for a certain revision of a file
--- @param bufnr integer
--- @param base string?
Expand Down Expand Up @@ -97,7 +99,7 @@ local function create_show_buf(bufnr, base)
group = 'gitsigns',
buffer = dbuf,
callback = function()
bufread(bufnr, dbuf, base)
async.run(bufread, bufnr, dbuf, base)
end,
})

Expand All @@ -120,6 +122,7 @@ end
--- @field vertical boolean
--- @field split string

--- @async
--- @param base string?
--- @param opts? Gitsigns.DiffthisOpts
local function diffthis_rev(base, opts)
Expand Down

0 comments on commit 690f298

Please sign in to comment.