Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Error: Attempt to index a nil value #12

Open
ofseed opened this issue Mar 20, 2024 · 1 comment
Open

Error: Attempt to index a nil value #12

ofseed opened this issue Mar 20, 2024 · 1 comment

Comments

@ofseed
Copy link

ofseed commented Mar 20, 2024

Error executing vim.schedule lua callback: ...re/nvim/lazy/sentiment.nvim/lua/sentiment/ui/Portion.lua:69: attempt to index a nil value
stack traceback:
	...re/nvim/lazy/sentiment.nvim/lua/sentiment/ui/Portion.lua:69: in function 'get_current_char'
	...ocal/share/nvim/lazy/sentiment.nvim/lua/sentiment/ui.lua:64: in function 'find_pair'
	...ocal/share/nvim/lazy/sentiment.nvim/lua/sentiment/ui.lua:143: in function ''
	vim/_editor.lua: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>

I've found this bug for one year, but I can never reproduce it stably.

@aidancz
Copy link

aidancz commented Jul 27, 2024

Error executing vim.schedule lua callback: ...re/nvim/lazy/sentiment.nvim/lua/sentiment/ui/Portion.lua:69: attempt to index a nil value
stack traceback:
        ...re/nvim/lazy/sentiment.nvim/lua/sentiment/ui/Portion.lua:69: in function 'get_current_char'
        ...ocal/share/nvim/lazy/sentiment.nvim/lua/sentiment/ui.lua:64: in function 'find_pair'
        ...ocal/share/nvim/lazy/sentiment.nvim/lua/sentiment/ui.lua:143: in function ''
        vim/_editor.lua: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

@ofseed same bug here, but i can stably reproduce it:

  1. prepare 2 files:

debug.lua:

vim.opt.splitkeep = 'topline'

--  plugin
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup(
{
	{
		'utilyre/sentiment.nvim',
		init = function()
			vim.g.loaded_matchparen = 1
			vim.opt.showmatch = false
		end,
		config = function()
			require('sentiment').setup({
				included_modes = {
					n = true,
					i = true,
				},
				delay = 0,
			})
		end,
	},
},
{
}
)

dwm.c:

{
	some text
}
  1. run command nvim -u debug.lua dwm.c
  2. after opening the file dwm.c, press j to move down by 1 line
  3. press :h<CR> to open the help buffer
  4. error

note that after commenting out vim.opt.splitkeep = 'topline', this error won't happen

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

No branches or pull requests

2 participants