ziontee113 / syntax-tree-surfer

A plugin for Neovim that helps you surf through your document and move elements around using the nvim-treesitter API.
MIT License
469 stars 9 forks source link

Visual Jump error reproduction #15

Closed brycepg closed 7 months ago

brycepg commented 1 year ago

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", {})
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

ziontee113 commented 1 year ago

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.