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

WinLeave error when opening Go tests in new tab #108

Open
kossmar opened this issue Mar 13, 2023 · 2 comments · May be fixed by #120
Open

WinLeave error when opening Go tests in new tab #108

kossmar opened this issue Mar 13, 2023 · 2 comments · May be fixed by #120
Labels
bug Something isn't working

Comments

@kossmar
Copy link

kossmar commented Mar 13, 2023

Neovim version (nvim -v | head -n1)

NVIM v0.7.2

Operating system/version

macOS 10.15.7

How to reproduce the issue

  1. Install plugins:
  1. Install golang

  2. Add this function to init.vim

command Test call <SID>maketest()
function! s:maketest()
    if TabooTabName(tabpagenr()) == "maketest"
        AsyncRun -raw make test
        set filetype=text
    else
        AsyncRun -raw make test
        copen

        " move the error window to a new tab (see :help window-moving)
        exe "normal \<c-w>T" 
        TabooRename maketest
        set filetype=text
    endif
endfunction
  1. call :Test in nvim

Expected behavior

Should open the tests in a new tab. And it does but I have to click through an error as specified below.

Actual behavior

Same as the expected behaviour but I have to click through this error.

Error detected while processing WinLeave Autocommands for "<buffer=3>":                                                                       
E5108: Error executing lua .../.config/nvim/plugged/nvim-bqf/lua/bqf/qfwin/session.lua:96: attempt to index local 'obj' (a nil value)         
stack traceback:                                                                                                                              
        .../.config/nvim/plugged/nvim-bqf/lua/bqf/qfwin/session.lua:96: in function 'saveWinView'                                             
        ...s/markoss/.config/nvim/plugged/nvim-bqf/lua/bqf/main.lua:103: in function 'saveWinView'  

Screen Shot 2023-03-13 at 4 16 59 PM

I fixed it by adding a nil check to lua/bqf/qfwin/session.lua and this stopped the errors but I don't know if it might break something else...?

function QfSession:saveWinView(winid)
    if winid then
        local obj = self.pool[winid]
        local wv = utils.winCall(winid, fn.winsaveview)
        if obj ~= nil then
            obj:list():setWinView(wv)
        end
    end
end
@kossmar kossmar added the bug Something isn't working label Mar 13, 2023
@kevinhwang91
Copy link
Owner

The solution is not bad, please make a PR for it.

@Subjective
Copy link
Contributor

Subjective commented Sep 9, 2023

I've also experienced this issue when toggling zen mode in the quickfix menu. Just opened a PR #120 that adds the nil check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants