nvim errors when starting a new review?
chon-sou opened this issue · comments
Issue Description
Type: bug report or feature request
Describe what happened (or what feature you want)
I have a PR open i.e. in a octo pr buffer. I type :Octo review start
. It gives the following error.
Error executing vim.schedule lua callback: /Users/chonsou/.vim/plugged/octo.nvim/lua/octo/utils.lua:856: BufFilePost Autocommands for "*"..function <SNR>37_on_buffilepost, line 3: Vim(throw):E488: Trailing ch
aracters: s:renaming[0] a:bufnr
stack traceback:
[C]: in function 'nvim_buf_set_name'
/Users/chonsou/.vim/plugged/octo.nvim/lua/octo/utils.lua:856: in function 'wipe_named_buffer'
...u/.vim/plugged/octo.nvim/lua/octo/reviews/file-entry.lua:470: in function '_get_null_buffer'
...u/.vim/plugged/octo.nvim/lua/octo/reviews/file-entry.lua:442: in function 'load_null_buffer'
...u/.vim/plugged/octo.nvim/lua/octo/reviews/file-entry.lua:438: in function 'load_null_buffers'
...onsou/.vim/plugged/octo.nvim/lua/octo/reviews/layout.lua:203: in function 'file_safeguard'
...onsou/.vim/plugged/octo.nvim/lua/octo/reviews/layout.lua:56: in function 'open'
...chonsou/.vim/plugged/octo.nvim/lua/octo/reviews/init.lua:150: in function 'initiate'
...chonsou/.vim/plugged/octo.nvim/lua/octo/reviews/init.lua:58: in function 'callback'
...chonsou/.vim/plugged/octo.nvim/lua/octo/reviews/init.lua:46: in function 'cb'
/Users/chonsou/.vim/plugged/octo.nvim/lua/octo/gh/init.lua:161: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
I can tell the review has started cause running the same command leads to it telling me I can only have one pending review per pr. I proceed to discard it.
If i comment out the following problematic code in file-entry.lua
it runs fine and displays the diff windows, but subsequent operations will throw error. I dug around and it seems that when it tries to load two new null buffers, it succeeds in nvim_buf_set_name
the first one, but it fails in doing so with the second null buffer
function M._get_null_buffer()
local msg = "Loading ..."
local bn = M._null_buffer[msg]
if not bn or vim.api.nvim_buf_is_loaded(bn) then
local nbn = vim.api.nvim_create_buf(false, false)
vim.api.nvim_buf_set_lines(nbn, 0, -1, false, { msg })
local bufname = utils.path_join { "octo", "null" }
vim.api.nvim_buf_set_option(nbn, "modified", false)
vim.api.nvim_buf_set_option(nbn, "modifiable", false)
---local ok, err = pcall(vim.api.nvim_buf_set_name, nbn, bufname)
---if not ok then
--- utils.wipe_named_buffer(bufname)
--- vim.api.nvim_buf_set_name(nbn, bufname)
--- end
M._null_buffer[msg] = nbn
end
return M._null_buffer[msg]
end
Describe what you expected to happen
I expect this command to open two diffsplit windows for the pr and a list of changed files.
How to reproduce it (as minimally and precisely as possible)
- Open any PR e.g.
Octo pr edit xxxx
Octo review start
Tell us your environment
Anything else we need to know?
further investigation it seems to be in conflict with a BufWritePost
autocommand with vim-gitgutter
I too get this issue, and it is solved by disableing vim-gitgutter
. Is it possible to solve, I haven't looked into it yet, or do you have a workaround for it?