2.1.0 (#241)
• removes the <esc> keybinding for popups which was causing folks to lose their changes • deprecates the backup register. • updates go-gitlab to latest in order to get "drafts" functionality • fixes issues with labels not deleting correctly • creates a new data() function to get data from the plugin directly, see :h gitlab.nvim.data • fixes issues with line values not being computed directly, blocking jumps to/from discussion tree This is a #MINOR release.
This commit is contained in:
committed by
GitHub
parent
12c4acb297
commit
36f512cd6d
45
lua/gitlab/actions/data.lua
Normal file
45
lua/gitlab/actions/data.lua
Normal file
@@ -0,0 +1,45 @@
|
||||
local u = require("gitlab.utils")
|
||||
local async = require("gitlab.async")
|
||||
local state = require("gitlab.state")
|
||||
local M = {}
|
||||
|
||||
local user = state.dependencies.user
|
||||
local info = state.dependencies.info
|
||||
local labels = state.dependencies.labels
|
||||
local project_members = state.dependencies.project_members
|
||||
local revisions = state.dependencies.revisions
|
||||
local latest_pipeline = state.dependencies.latest_pipeline
|
||||
|
||||
M.data = function(resources, cb)
|
||||
if type(resources) ~= "table" or type(cb) ~= "function" then
|
||||
u.notify("The data function must be passed a resources table and a callback function", vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
|
||||
local all_resources = {
|
||||
info = info,
|
||||
user = user,
|
||||
labels = labels,
|
||||
project_members = project_members,
|
||||
revisions = revisions,
|
||||
pipeline = latest_pipeline,
|
||||
}
|
||||
|
||||
local api_calls = {}
|
||||
for _, resource in ipairs(resources) do
|
||||
local api_call = all_resources[resource.type]
|
||||
table.insert(api_calls, u.merge(api_call, { refresh = resource.refresh }))
|
||||
end
|
||||
|
||||
-- TODO: Build an async "parallel" that fetches the resources
|
||||
-- in parallel where possible to speed up this API
|
||||
return async.sequence(api_calls, function()
|
||||
local data = {}
|
||||
for k, v in pairs(all_resources) do
|
||||
data[k] = state[v.state]
|
||||
end
|
||||
cb(data)
|
||||
end)()
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user