Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvim errors when starting a new review? #528

Open
chon-sou opened this issue Mar 25, 2024 · 3 comments
Open

nvim errors when starting a new review? #528

chon-sou opened this issue Mar 25, 2024 · 3 comments

Comments

@chon-sou
Copy link

chon-sou commented Mar 25, 2024

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)

  1. Open any PR e.g. Octo pr edit xxxx
  2. Octo review start

Tell us your environment

Anything else we need to know?

@chon-sou
Copy link
Author

further investigation it seems to be in conflict with a BufWritePost autocommand with vim-gitgutter

@phdah
Copy link

phdah commented Apr 9, 2024

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?

@phdah
Copy link

phdah commented Apr 9, 2024

This issue already exists here: #441
And a work around is presented there

I had the same, and disabling gitgutter fixed it for me. I found gitsigns can do the same and doesn't interfere with this plugin.

Maybe close this issue, and continue in the other thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants