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:
Harrison (Harry) Cramer
2025-01-18 11:22:24 -05:00
committed by GitHub
parent 495e64c8bc
commit 3b396a5e6b
5 changed files with 37 additions and 9 deletions

View File

@@ -109,7 +109,6 @@ M.jump = function(file_name, line_number, new_buffer)
return
end
vim.api.nvim_set_current_tabpage(M.tabnr)
vim.cmd("DiffviewFocusFiles")
local view = diffview_lib.get_current_view()
if view == nil then
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)
return file.path == file_name
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))
local layout = view.cur_layout
@@ -325,7 +331,8 @@ local set_keymaps = function(bufnr, keymaps)
if keymaps.reviewer.create_comment ~= false then
-- Set keymap for repeated operator keybinding
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, {
buffer = bufnr,
desc = "Create comment for [count] lines",
@@ -355,7 +362,8 @@ local set_keymaps = function(bufnr, keymaps)
if keymaps.reviewer.create_suggestion ~= false then
-- Set keymap for repeated operator keybinding
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, {
buffer = bufnr,
desc = "Create suggestion for [count] lines",