Release (#313)
* Fix docs: choose_merge_request's open_reviewer default value is true (#316) * Fix: Only set autocommands for select popups (#315) * Docs: Small improvements to README and docs * Feat: Add branch info to choose_merge_request menu (#318) This is a PATCH release.
This commit is contained in:
committed by
GitHub
parent
96d7e16ef7
commit
3c9d95d25b
@@ -29,6 +29,9 @@ To view these help docs and to get more detailed help information, please run `:
|
|||||||
|
|
||||||
This will checkout the branch locally, and open the plugin's reviewer pane.
|
This will checkout the branch locally, and open the plugin's reviewer pane.
|
||||||
|
|
||||||
|
NOTE: At the moment, the plugin assumes that the remote where you want to merge your feature branch
|
||||||
|
is called "origin".
|
||||||
|
|
||||||
For more detailed information about the Lua APIs please run `:h gitlab.nvim.api`
|
For more detailed information about the Lua APIs please run `:h gitlab.nvim.api`
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ QUICK START *gitlab.nvim.quick-start*
|
|||||||
|
|
||||||
This will checkout the branch locally, and up the plugin's reviewer pane.
|
This will checkout the branch locally, and up the plugin's reviewer pane.
|
||||||
|
|
||||||
|
NOTE: At the moment, the plugin assumes that the remote where you want to
|
||||||
|
merge your feature branch is called "origin".
|
||||||
|
|
||||||
|
|
||||||
INSTALLATION *gitlab.nvim.installation*
|
INSTALLATION *gitlab.nvim.installation*
|
||||||
|
|
||||||
@@ -78,25 +81,25 @@ With Lazy:
|
|||||||
<
|
<
|
||||||
And with Packer:
|
And with Packer:
|
||||||
>lua
|
>lua
|
||||||
use {
|
use {
|
||||||
"harrisoncramer/gitlab.nvim",
|
"harrisoncramer/gitlab.nvim",
|
||||||
requires = {
|
requires = {
|
||||||
"MunifTanjim/nui.nvim",
|
"MunifTanjim/nui.nvim",
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
"sindrets/diffview.nvim"
|
"sindrets/diffview.nvim",
|
||||||
"stevearc/dressing.nvim", -- Recommended but not required. Better UI for pickers.
|
"stevearc/dressing.nvim", -- Recommended but not required. Better UI for pickers.
|
||||||
"nvim-tree/nvim-web-devicons", -- Recommended but not required. Icons in discussion tree.
|
"nvim-tree/nvim-web-devicons", -- Recommended but not required. Icons in discussion tree.
|
||||||
},
|
},
|
||||||
build = function()
|
build = function()
|
||||||
require("gitlab.server").build()
|
require("gitlab.server").build()
|
||||||
end,
|
end,
|
||||||
branch = "develop",
|
branch = "develop",
|
||||||
config = function()
|
config = function()
|
||||||
require("diffview") -- We require some global state from diffview
|
require("diffview") -- We require some global state from diffview
|
||||||
local gitlab = require("gitlab")
|
local gitlab = require("gitlab")
|
||||||
gitlab.setup()
|
gitlab.setup()
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
<
|
<
|
||||||
|
|
||||||
CONNECTING TO GITLAB *gitlab.nvim.connecting-to-gitlab*
|
CONNECTING TO GITLAB *gitlab.nvim.connecting-to-gitlab*
|
||||||
@@ -418,18 +421,18 @@ SIGNS AND DIAGNOSTICS *gitlab.nvim.signs-and-diagnostics*
|
|||||||
By default when reviewing files, you will see diagnostics for comments that
|
By default when reviewing files, you will see diagnostics for comments that
|
||||||
have been added to a review. These are the default settings:
|
have been added to a review. These are the default settings:
|
||||||
>lua
|
>lua
|
||||||
discussion_signs = {
|
discussion_signs = {
|
||||||
enabled = true, -- Show diagnostics for gitlab comments in the reviewer
|
enabled = true, -- Show diagnostics for gitlab comments in the reviewer
|
||||||
skip_resolved_discussion = false, -- Show diagnostics for resolved discussions
|
skip_resolved_discussion = false, -- Show diagnostics for resolved discussions
|
||||||
severity = vim.diagnostic.severity.INFO, -- ERROR, WARN, INFO, or HINT
|
severity = vim.diagnostic.severity.INFO, -- ERROR, WARN, INFO, or HINT
|
||||||
virtual_text = false, -- Whether to show the comment text inline as floating virtual text
|
virtual_text = false, -- Whether to show the comment text inline as floating virtual text
|
||||||
use_diagnostic_signs = true, -- Show diagnostic sign (depending on the `severity` setting, e.g., I for INFO) along with the comment icon
|
use_diagnostic_signs = true, -- Show diagnostic sign (depending on the `severity` setting, e.g., I for INFO) along with the comment icon
|
||||||
priority = 100, -- Higher will override LSP warnings, etc
|
priority = 100, -- Higher will override LSP warnings, etc
|
||||||
icons = {
|
icons = {
|
||||||
comment = "→|",
|
comment = "→|",
|
||||||
range = " |",
|
range = " |",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
|
|
||||||
When the cursor is on a diagnostic line you can view the discussion thread by
|
When the cursor is on a diagnostic line you can view the discussion thread by
|
||||||
using `vim.diagnostic.show()`.
|
using `vim.diagnostic.show()`.
|
||||||
@@ -630,9 +633,10 @@ default arguments outlined under "Configuring the Plugin".
|
|||||||
*gitlab.nvim.choose_merge_request*
|
*gitlab.nvim.choose_merge_request*
|
||||||
gitlab.choose_merge_request({opts}) ~
|
gitlab.choose_merge_request({opts}) ~
|
||||||
|
|
||||||
Choose a merge request from a list of those open in your current project to review.
|
Choose a merge request from a list of those open in your current project to
|
||||||
This command will automatically check out that branch locally, and optionally
|
review. This command will automatically check out the feature branch locally,
|
||||||
open the reviewer pane. This is the default behavior.
|
and by default also open the reviewer pane (this can be overridden with the
|
||||||
|
`open_reviewer` parameter).
|
||||||
>lua
|
>lua
|
||||||
require("gitlab").choose_merge_request()
|
require("gitlab").choose_merge_request()
|
||||||
require("gitlab").choose_merge_request({ open_reviewer = false })
|
require("gitlab").choose_merge_request({ open_reviewer = false })
|
||||||
|
|||||||
@@ -316,8 +316,6 @@ M.create_mr = function()
|
|||||||
forked_project_id = forked_project_id,
|
forked_project_id = forked_project_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.print(body)
|
|
||||||
|
|
||||||
job.run_job("/create_mr", "POST", body, function(data)
|
job.run_job("/create_mr", "POST", body, function(data)
|
||||||
u.notify(data.message, vim.log.levels.INFO)
|
u.notify(data.message, vim.log.levels.INFO)
|
||||||
M.reset_state()
|
M.reset_state()
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ M.choose_merge_request = function(opts)
|
|||||||
vim.ui.select(state.MERGE_REQUESTS, {
|
vim.ui.select(state.MERGE_REQUESTS, {
|
||||||
prompt = "Choose Merge Request",
|
prompt = "Choose Merge Request",
|
||||||
format_item = function(mr)
|
format_item = function(mr)
|
||||||
return string.format("%s (%s)", mr.title, mr.author.name)
|
return string.format("%s [%s -> %s] (%s)", mr.title, mr.source_branch, mr.target_branch, mr.author.name)
|
||||||
end,
|
end,
|
||||||
}, function(choice)
|
}, function(choice)
|
||||||
if not choice then
|
if not choice then
|
||||||
|
|||||||
@@ -63,10 +63,20 @@ M.summary = function()
|
|||||||
description_popup,
|
description_popup,
|
||||||
M.edit_summary,
|
M.edit_summary,
|
||||||
miscellaneous.attach_file,
|
miscellaneous.attach_file,
|
||||||
{ cb = exit, action_before_close = true, save_to_temp_register = true }
|
{ cb = exit, action_before_close = true, action_before_exit = true, save_to_temp_register = true }
|
||||||
|
)
|
||||||
|
state.set_popup_keymaps(
|
||||||
|
title_popup,
|
||||||
|
M.edit_summary,
|
||||||
|
nil,
|
||||||
|
{ cb = exit, action_before_close = true, action_before_exit = true }
|
||||||
|
)
|
||||||
|
state.set_popup_keymaps(
|
||||||
|
info_popup,
|
||||||
|
M.edit_summary,
|
||||||
|
nil,
|
||||||
|
{ cb = exit, action_before_close = true, action_before_exit = true }
|
||||||
)
|
)
|
||||||
state.set_popup_keymaps(title_popup, M.edit_summary, nil, { cb = exit, action_before_close = true })
|
|
||||||
state.set_popup_keymaps(info_popup, M.edit_summary, nil, { cb = exit, action_before_close = true })
|
|
||||||
miscellaneous.set_cycle_popups_keymaps(popups)
|
miscellaneous.set_cycle_popups_keymaps(popups)
|
||||||
|
|
||||||
vim.api.nvim_set_current_buf(description_popup.bufnr)
|
vim.api.nvim_set_current_buf(description_popup.bufnr)
|
||||||
@@ -151,8 +161,6 @@ M.edit_summary = function()
|
|||||||
u.notify(data.message, vim.log.levels.INFO)
|
u.notify(data.message, vim.log.levels.INFO)
|
||||||
state.INFO.description = data.mr.description
|
state.INFO.description = data.mr.description
|
||||||
state.INFO.title = data.mr.title
|
state.INFO.title = data.mr.title
|
||||||
M.layout:unmount()
|
|
||||||
M.layout_visible = false
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -295,9 +295,9 @@ M.set_popup_keymaps = function(popup, action, linewise_action, opts)
|
|||||||
local text = u.get_buffer_text(popup.bufnr)
|
local text = u.get_buffer_text(popup.bufnr)
|
||||||
if opts.action_before_close then
|
if opts.action_before_close then
|
||||||
action(text, popup.bufnr)
|
action(text, popup.bufnr)
|
||||||
vim.api.nvim_buf_delete(popup.bufnr, {})
|
exit(popup, opts)
|
||||||
else
|
else
|
||||||
vim.api.nvim_buf_delete(popup.bufnr, {})
|
exit(popup, opts)
|
||||||
action(text, popup.bufnr)
|
action(text, popup.bufnr)
|
||||||
end
|
end
|
||||||
end, { buffer = popup.bufnr, desc = "Perform action" })
|
end, { buffer = popup.bufnr, desc = "Perform action" })
|
||||||
@@ -312,18 +312,26 @@ M.set_popup_keymaps = function(popup, action, linewise_action, opts)
|
|||||||
end, { buffer = popup.bufnr, desc = "Perform linewise action" })
|
end, { buffer = popup.bufnr, desc = "Perform linewise action" })
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("BufWinLeave", {
|
if opts.save_to_temp_register then
|
||||||
buffer = popup.bufnr,
|
vim.api.nvim_create_autocmd("BufWinLeave", {
|
||||||
callback = function()
|
buffer = popup.bufnr,
|
||||||
if opts.save_to_temp_register then
|
callback = function()
|
||||||
local text = u.get_buffer_text(popup.bufnr)
|
local text = u.get_buffer_text(popup.bufnr)
|
||||||
for _, register in ipairs(M.settings.popup.temp_registers) do
|
for _, register in ipairs(M.settings.popup.temp_registers) do
|
||||||
vim.fn.setreg(register, text)
|
vim.fn.setreg(register, text)
|
||||||
end
|
end
|
||||||
end
|
end,
|
||||||
exit(popup, opts)
|
})
|
||||||
end,
|
end
|
||||||
})
|
|
||||||
|
if opts.action_before_exit then
|
||||||
|
vim.api.nvim_create_autocmd("BufWinLeave", {
|
||||||
|
buffer = popup.bufnr,
|
||||||
|
callback = function()
|
||||||
|
exit(popup, opts)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Dependencies
|
-- Dependencies
|
||||||
|
|||||||
Reference in New Issue
Block a user