ziontee113/syntax-tree-surfer

Visual Jump error reproduction

brycepg opened this issue · 1 comments

Hey I'm testing this out and I encountered this error:

Create a file called repro.lua with the text

require "lsp_setup"

vim.api.nvim_create_user_command("Nvimrc", ":e ~/dotfiles/nvim/init.lua", {})
  • Shift-V on the require line and then expand the selection down to the blank space
  • Hit J do to jump
  • Receive the following error:
Error executing Lua callback: .../lazy/syntax-tree-surfer/lua/syntax-tree-surfer/init.lua:82: attempt to index local 'parent' (a nil value)
stack traceback:
.../lazy/syntax-tree-surfer/lua/syntax-tree-surfer/init.lua:82: in function 'get_visual_node'
.../lazy/syntax-tree-surfer/lua/syntax-tree-surfer/init.lua:122: in function 'surf'
.../lazy/syntax-tree-surfer/lua/syntax-tree-surfer/init.lua:301: in function <.../lazy/syntax-tree-surfer/lua/syntax-tree-surfer/init.lua:300>

Hope this helps, thank you. If you cannot repo I'd be happy to give you more system information

Hi @brycepg , I've updated the plugin to prevent the errors you just described.

One thing to note in your use case is the usage of Shift-V. The plugin doesn't work with Shift-V.
Instead, you could use other methods to select nodes described in the README file.

Thank you for reporting the issue. I'll leave the issue open for now in case you need more help regarding this.