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

[Bug]: attempt to call field 'iter' (a nil value) #1

Closed
nicktify opened this issue May 30, 2023 · 1 comment
Closed

[Bug]: attempt to call field 'iter' (a nil value) #1

nicktify opened this issue May 30, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@nicktify
Copy link

Description

Hello. I'm having a problem after installation.

Just after installing, I open a .js file and the error attempt to call field 'iter' (a nil value) appears.

I search for the function iter in the codebase of the dropbar .lua files and comment the following code and all works perfectly.

The code is in lua/sources/lsp.lua line 288

-- Code uncommented doesn't work
  for idx, symbol in vim.iter(lsp_symbols):enumerate():rev() do
    if cursor_in_range(cursor, symbol.range) then
      table.insert(
        dropbar_symbols,
        utils.to_dropbar_symbol(unify_document_symbol(symbol, lsp_symbols, idx))
      )
      if symbol.children then
        convert_document_symbol_list(symbol.children, dropbar_symbols, cursor)
      end
      return
    end
  end
--  This code commented, all works perfectly
  -- for idx, symbol in vim.iter(lsp_symbols):enumerate():rev() do
  --   if cursor_in_range(cursor, symbol.range) then
  --     table.insert(
  --       dropbar_symbols,
  --       utils.to_dropbar_symbol(unify_document_symbol(symbol, lsp_symbols, idx))
  --     )
  --     if symbol.children then
  --       convert_document_symbol_list(symbol.children, dropbar_symbols, cursor)
  --     end
  --     return
  --   end
  -- end

nvim version

NVIM v0.9.1

dropbar.nvim version

7ae61cc

Operating system and version

MacOS 13.3.1

Minimal config

require('dropbar').setup()

Steps to reproduce

  1. Install with Packer use('Bekaboo/dropbar.nvim')
  2. require('dropbar').setup()
  3. Open a javascript file

Expected behavior

Work without errors

Actual behavior

Error executing vim.schedule lua callback: ...ck/packer/start/dropbar.nvim/lua/dropbar/sources/lsp.lua:288: attempt to call fi
eld 'iter' (a nil value)
stack traceback:
        ...ck/packer/start/dropbar.nvim/lua/dropbar/sources/lsp.lua:288: in function 'convert_document_symbol_list'
        ...ck/packer/start/dropbar.nvim/lua/dropbar/sources/lsp.lua:311: in function 'get_symbols'
        ...e/pack/packer/start/dropbar.nvim/lua/dropbar/configs.lua:119: in function 'get_symbols'
        .../site/pack/packer/start/dropbar.nvim/lua/dropbar/bar.lua:280: in function 'update'
        ...ck/packer/start/dropbar.nvim/lua/dropbar/sources/lsp.lua:343: in function 'handler'
        ...w/Cellar/neovim/0.9.1/share/nvim/runtime/lua/vim/lsp.lua:1394: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

Additional information

No response

@nicktify nicktify added the bug Something isn't working label May 30, 2023
@Bekaboo
Copy link
Owner

Bekaboo commented May 30, 2023

Sorry about the inconvenience! I made a mistake about the nvim version required for this plugin, actually it is required to have nvim nightly (>= 0.10.0) for dropbar.nvim to work since the vim.iter module is new feature introduced in nvim nightly. Thanks for reporting.

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

No branches or pull requests

2 participants