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

Throwing some errors (wrong number of arguments; nil value sList) #70

Closed
daUnknownCoder opened this issue Jun 11, 2024 · 13 comments
Closed

Comments

@daUnknownCoder
Copy link

  • nvim --version: 0.10.0
  • Operating system/version: archlinux

Describe the bug
I'm getting some weirdo errors: (Doesnt happen of plugin load, only happens when we use the plugin explicitly)
First Error:

Error executing vim.schedule lua callback: .../share/NeutronVim/lazy/nvim-hlslens/lua/hlslens/wffi.lua:24: wrong number of arguments for function call
stack traceback:
	[C]: in function 'ml_get_buf'
	.../share/NeutronVim/lazy/nvim-hlslens/lua/hlslens/wffi.lua:24: in function 'mlGetBufLen'
	...m/lazy/nvim-hlslens/lua/hlslens/position/range/regex.lua:33: in function 'buildList'
	...utronVim/lazy/nvim-hlslens/lua/hlslens/position/init.lua:71: in function 'compute'
	...NeutronVim/lazy/nvim-hlslens/lua/hlslens/render/init.lua:84: in function 'refreshCurrentBuf'
	...NeutronVim/lazy/nvim-hlslens/lua/hlslens/render/init.lua:424: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>

Second error (every time i call the plugin 2 times for each use)

Error executing vim.schedule lua callback: ...NeutronVim/lazy/nvim-hlslens/lua/hlslens/render/init.lua:89: attempt to get length of field 'sList' (a nil value)
stack traceback:
	...NeutronVim/lazy/nvim-hlslens/lua/hlslens/render/init.lua:89: in function 'refreshCurrentBuf'
	...NeutronVim/lazy/nvim-hlslens/lua/hlslens/render/init.lua:424: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>

To Reproduce using nvim -u mini.lua

return {
  "kevinhwang91/nvim-hlslens",
  event = { "CmdlineEnter", "BufReadPost", "BufNewFile" },
  enabled = true,
  keys = {
    {
      "n",
      [[<cmd>execute('normal! ' . v:count1 . 'n')<cr>]] .. [[<cmd>lua require("hlslens").start()<cr>]],
    },
    {
      "N",
      [[<cmd>execute('normal! ' . v:count1 . 'N')<cr>]] .. [[<cmd>lua require("hlslens").start()<cr>]],
    },
    { "*", "*" .. [[<cmd>lua require("hlslens").start()<cr>]] },
    { "#", "#" .. [[<cmd>lua require("hlslens").start()<cr>]] },
    { "g*", "g*" .. [[<cmd>lua require("hlslens").start()<cr>]] },
    { "g#", "g#" .. [[<cmd>lua require("hlslens").start()<cr>]] },
  },
  config = true,
}

Steps to reproduce the behavior:

  1. go to CmdLine and /<search term> or n or N
  2. the first error pops up, every time u do a related keypress, the second error pops up 2 times

Expected behavior
It should not throw any error

Screenshots
image

@daUnknownCoder
Copy link
Author

What was happening tho? Because your last commit was 2 months ago and this happened recently?

@kevinhwang91
Copy link
Owner

Don't use lazy, I am not sure the issue existed before, but the code has a bug.

@daUnknownCoder
Copy link
Author

Don't use lazy, I am not sure the issue existed before, but the code has a bug.

What should be the loading event? Or should I do lazy = false?

@kevinhwang91
Copy link
Owner

The bug should be gone for this issue.

@daUnknownCoder
Copy link
Author

daUnknownCoder commented Jun 14, 2024

The bug should be gone for this issue.

i still cannot use this i still get both wffi and sList error

Edit: i get a new cFunc error:

Error executing vim.schedule lua callback: ...NeutronVim/lazy/hlchunk.nvim/lua/hlchunk/utils/cFunc.lua:47: wrong number of arguments for function call
stack traceback:
	[C]: in function 'ml_get_buf'
	...NeutronVim/lazy/hlchunk.nvim/lua/hlchunk/utils/cFunc.lua:47: in function 'get_line'
	...tronVim/lazy/hlchunk.nvim/lua/hlchunk/utils/position.lua:21: in function 'get_char_at_pos'
	...ronVim/lazy/hlchunk.nvim/lua/hlchunk/mods/chunk/init.lua:101: in function 'get_chunk_data'
	...ronVim/lazy/hlchunk.nvim/lua/hlchunk/mods/chunk/init.lua:131: in function 'render'
	...ronVim/lazy/hlchunk.nvim/lua/hlchunk/mods/chunk/init.lua:187: in function 'fn'
	...NeutronVim/lazy/hlchunk.nvim/lua/hlchunk/utils/timer.lua:64: in function 'fn'
	...NeutronVim/lazy/hlchunk.nvim/lua/hlchunk/utils/timer.lua:16: in function <...NeutronVim/lazy/hlchunk.nvim/lua/hlchunk/utils/timer.lua:15>

@daUnknownCoder
Copy link
Author

with this config:

  {
    "kevinhwang91/nvim-hlslens",
    event = { "CmdlineEnter", "LazyFile" },
    enabled = true,
    keys = {
      {
        "n",
        [[<cmd>execute('normal! ' . v:count1 . 'n')<cr>]] .. [[<cmd>lua require("hlslens").start()<cr>]],
      },
      {
        "N",
        [[<cmd>execute('normal! ' . v:count1 . 'N')<cr>]] .. [[<cmd>lua require("hlslens").start()<cr>]],
      },
      { "*", "*" .. [[<cmd>lua require("hlslens").start()<cr>]] },
      { "#", "#" .. [[<cmd>lua require("hlslens").start()<cr>]] },
      { "g*", "g*" .. [[<cmd>lua require("hlslens").start()<cr>]] },
      { "g#", "g#" .. [[<cmd>lua require("hlslens").start()<cr>]] },
    },
    opts = {
      override_lens = function(render, posList, nearest, idx, relIdx)
        local sfw = vim.v.searchforward == 1
        local indicator, text, chunks
        local absRelIdx = math.abs(relIdx)
        if absRelIdx > 1 then
          indicator = ("%d%s"):format(absRelIdx, sfw ~= (relIdx > 1) and "" or "")
        elseif absRelIdx == 1 then
          indicator = sfw ~= (relIdx == 1) and "" or ""
        else
          indicator = ""
        end

        local lnum, col = unpack(posList[idx])
        if nearest then
          local cnt = #posList
          if indicator ~= "" then
            text = ("[%s %d/%d]"):format(indicator, idx, cnt)
          else
            text = ("[%d/%d]"):format(idx, cnt)
          end
          chunks = { { " " }, { text, "HlSearchLensNear" } }
        else
          text = ("[%s %d]"):format(indicator, idx)
          chunks = { { " " }, { text, "HlSearchLens" } }
        end
        render.setVirt(0, lnum - 1, col - 1, chunks, nearest)
      end,
    },
    config = true,
  },

im only getting the above cFunc error

@kevinhwang91
Copy link
Owner

hlchunk.nvim

what's hlchunk.nvim?

@kevinhwang91 kevinhwang91 reopened this Jun 14, 2024
@daUnknownCoder
Copy link
Author

daUnknownCoder commented Jun 14, 2024

hlchunk.nvim

what's hlchunk.nvim?

sorry thats another plugin but the name was similar 😞, tho this hasnt been fixed

the first time its wffi, then init.lua

Error executing vim.schedule lua callback: ...NeutronVim/lazy/nvim-hlslens/lua/hlslens/render/init.lua:89: attempt to get length of field 'sList' (a nil value)
stack traceback:
	...NeutronVim/lazy/nvim-hlslens/lua/hlslens/render/init.lua:89: in function 'refreshCurrentBuf'
	...NeutronVim/lazy/nvim-hlslens/lua/hlslens/render/init.lua:424: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>

@daUnknownCoder
Copy link
Author

works arigato Thanks a lot, just one more thing:
can i disable this:
image
the blue part -> but current_line_blame by gitsigns stays in between the orange and blue part so i wanna completely disable the blue part

@kevinhwang91
Copy link
Owner

maybe other plugins render /return [3/6] with cyan color.

@shellRaining
Copy link

maybe other plugins render /return [3/6] with cyan color.

I remember it seems like the information displayed by noice.nvim

by the way, I can't reproduce this bug, Has it been fixed already?

@daUnknownCoder
Copy link
Author

maybe other plugins render /return [3/6] with cyan color.

I remember it seems like the information displayed by noice.nvim

by the way, I can't reproduce this bug, Has it been fixed already?

yes its fixed, oh was it noice, thanks for that

@daUnknownCoder
Copy link
Author

this thing is fixed thanks buddy for ur time

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

3 participants