Release: Docs Improvements and Bug Fixes (#460)
Miscellaneous bug fixes and improvements. docs: various improvements (#445) fix: don't jump to file from reviewer if it doesn't exist (#452) fix: force linewise motion in suggestion keybinding (#454) fix: prevent error after plenary job update (#456) fix: fix JSON on Windows (#458) fix: remove retry logic (#449) fix: check whether comment can be created (#434)
This commit is contained in:
committed by
GitHub
parent
495e64c8bc
commit
3b396a5e6b
@@ -68,6 +68,7 @@ func NewClient() (*Client, error) {
|
|||||||
|
|
||||||
retryClient := retryablehttp.NewClient()
|
retryClient := retryablehttp.NewClient()
|
||||||
retryClient.HTTPClient.Transport = tr
|
retryClient.HTTPClient.Transport = tr
|
||||||
|
retryClient.RetryMax = 0
|
||||||
gitlabOptions = append(gitlabOptions, gitlab.WithHTTPClient(retryClient.HTTPClient))
|
gitlabOptions = append(gitlabOptions, gitlab.WithHTTPClient(retryClient.HTTPClient))
|
||||||
|
|
||||||
client, err := gitlab.NewClient(pluginOptions.AuthToken, gitlabOptions...)
|
client, err := gitlab.NewClient(pluginOptions.AuthToken, gitlabOptions...)
|
||||||
|
|||||||
@@ -293,6 +293,13 @@ M.jump_to_file = function(tree)
|
|||||||
u.notify("This comment was not left on a particular location", vim.log.levels.WARN)
|
u.notify("This comment was not left on a particular location", vim.log.levels.WARN)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if vim.fn.filereadable(root_node.file_name) == 0 then
|
||||||
|
u.notify(
|
||||||
|
string.format("The file %s for which the comment was made doesn't exist in HEAD.", root_node.file_name),
|
||||||
|
vim.log.levels.WARN
|
||||||
|
)
|
||||||
|
return
|
||||||
|
end
|
||||||
vim.cmd.tabnew()
|
vim.cmd.tabnew()
|
||||||
local line_number = get_new_line(root_node) or get_old_line(root_node)
|
local line_number = get_new_line(root_node) or get_old_line(root_node)
|
||||||
if line_number == nil then
|
if line_number == nil then
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ M.run_job = function(endpoint, method, body, callback)
|
|||||||
-- This handler will handle all responses from the Go server. Anything with a successful
|
-- This handler will handle all responses from the Go server. Anything with a successful
|
||||||
-- status will call the callback (if it is supplied for the job). Otherwise, it will print out the
|
-- status will call the callback (if it is supplied for the job). Otherwise, it will print out the
|
||||||
-- success message or error message and details from the Go server.
|
-- success message or error message and details from the Go server.
|
||||||
|
local stderr = {}
|
||||||
Job:new({
|
Job:new({
|
||||||
command = "curl",
|
command = "curl",
|
||||||
args = args,
|
args = args,
|
||||||
@@ -55,13 +56,20 @@ M.run_job = function(endpoint, method, body, callback)
|
|||||||
end
|
end
|
||||||
end, 0)
|
end, 0)
|
||||||
end,
|
end,
|
||||||
on_stderr = function()
|
on_stderr = function(_, data)
|
||||||
vim.defer_fn(function()
|
if data then
|
||||||
u.notify("Could not run command!", vim.log.levels.ERROR)
|
table.insert(stderr, data)
|
||||||
end, 0)
|
end
|
||||||
end,
|
end,
|
||||||
on_exit = function(_, status)
|
on_exit = function(code, status)
|
||||||
vim.defer_fn(function()
|
vim.defer_fn(function()
|
||||||
|
if #stderr ~= 0 then
|
||||||
|
u.notify(
|
||||||
|
string.format("Could not run command `%s %s`! Stderr was:", code.command, table.concat(code.args, " ")),
|
||||||
|
vim.log.levels.ERROR
|
||||||
|
)
|
||||||
|
vim.notify(string.format("%s", table.concat(stderr, "\n")), vim.log.levels.ERROR)
|
||||||
|
end
|
||||||
if status ~= 0 then
|
if status ~= 0 then
|
||||||
u.notify(string.format("Go server exited with non-zero code: %d", status), vim.log.levels.ERROR)
|
u.notify(string.format("Go server exited with non-zero code: %d", status), vim.log.levels.ERROR)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -109,7 +109,6 @@ M.jump = function(file_name, line_number, new_buffer)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
vim.api.nvim_set_current_tabpage(M.tabnr)
|
vim.api.nvim_set_current_tabpage(M.tabnr)
|
||||||
vim.cmd("DiffviewFocusFiles")
|
|
||||||
local view = diffview_lib.get_current_view()
|
local view = diffview_lib.get_current_view()
|
||||||
if view == nil then
|
if view == nil then
|
||||||
u.notify("Could not find Diffview view", vim.log.levels.ERROR)
|
u.notify("Could not find Diffview view", vim.log.levels.ERROR)
|
||||||
@@ -120,6 +119,13 @@ M.jump = function(file_name, line_number, new_buffer)
|
|||||||
local file = List.new(files):find(function(file)
|
local file = List.new(files):find(function(file)
|
||||||
return file.path == file_name
|
return file.path == file_name
|
||||||
end)
|
end)
|
||||||
|
if file == nil then
|
||||||
|
u.notify(
|
||||||
|
string.format("The file %s for which the comment was made doesn't exist in HEAD.", file_name),
|
||||||
|
vim.log.levels.WARN
|
||||||
|
)
|
||||||
|
return
|
||||||
|
end
|
||||||
async.await(view:set_file(file))
|
async.await(view:set_file(file))
|
||||||
|
|
||||||
local layout = view.cur_layout
|
local layout = view.cur_layout
|
||||||
@@ -325,7 +331,8 @@ local set_keymaps = function(bufnr, keymaps)
|
|||||||
if keymaps.reviewer.create_comment ~= false then
|
if keymaps.reviewer.create_comment ~= false then
|
||||||
-- Set keymap for repeated operator keybinding
|
-- Set keymap for repeated operator keybinding
|
||||||
vim.keymap.set("o", keymaps.reviewer.create_comment, function()
|
vim.keymap.set("o", keymaps.reviewer.create_comment, function()
|
||||||
vim.api.nvim_cmd({ cmd = "normal", bang = true, args = { tostring(vim.v.count1) .. "$" } }, {})
|
-- The "V" in "V%d$" forces linewise motion, see `:h o_V`
|
||||||
|
vim.api.nvim_cmd({ cmd = "normal", bang = true, args = { string.format("V%d$", vim.v.count1) } }, {})
|
||||||
end, {
|
end, {
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
desc = "Create comment for [count] lines",
|
desc = "Create comment for [count] lines",
|
||||||
@@ -355,7 +362,8 @@ local set_keymaps = function(bufnr, keymaps)
|
|||||||
if keymaps.reviewer.create_suggestion ~= false then
|
if keymaps.reviewer.create_suggestion ~= false then
|
||||||
-- Set keymap for repeated operator keybinding
|
-- Set keymap for repeated operator keybinding
|
||||||
vim.keymap.set("o", keymaps.reviewer.create_suggestion, function()
|
vim.keymap.set("o", keymaps.reviewer.create_suggestion, function()
|
||||||
vim.api.nvim_cmd({ cmd = "normal", bang = true, args = { tostring(vim.v.count1) .. "$" } }, {})
|
-- The "V" in "V%d$" forces linewise motion, see `:h o_V`
|
||||||
|
vim.api.nvim_cmd({ cmd = "normal", bang = true, args = { string.format("V%d$", vim.v.count1) } }, {})
|
||||||
end, {
|
end, {
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
desc = "Create suggestion for [count] lines",
|
desc = "Create suggestion for [count] lines",
|
||||||
|
|||||||
@@ -26,7 +26,11 @@ M.start = function(callback)
|
|||||||
state.chosen_mr_iid = 0 -- Do not let this interfere with subsequent reviewer.open() calls
|
state.chosen_mr_iid = 0 -- Do not let this interfere with subsequent reviewer.open() calls
|
||||||
|
|
||||||
local settings = vim.json.encode(go_server_settings)
|
local settings = vim.json.encode(go_server_settings)
|
||||||
local command = string.format("%s '%s'", state.settings.bin, settings)
|
if vim.fn.has("win32") then
|
||||||
|
settings = settings:gsub('"', '\\"')
|
||||||
|
end
|
||||||
|
|
||||||
|
local command = string.format('"%s" "%s"', state.settings.bin, settings)
|
||||||
|
|
||||||
local job_id = vim.fn.jobstart(command, {
|
local job_id = vim.fn.jobstart(command, {
|
||||||
on_stdout = function(_, data)
|
on_stdout = function(_, data)
|
||||||
|
|||||||
Reference in New Issue
Block a user