edolphin-ydf / goimpl.nvim

Generate stub for interface on a type
54 stars 6 forks source link

Thows exception when try to generate on struct that under parent type #12

Closed crayonwow closed 1 year ago

crayonwow commented 1 year ago

When defined stuct under a parent type

type(
    test1 struct {
        value int
    }
    test2 struct {
        value int
    }
)

throws exception:

E5108: Error executing lua: ...r/neovim/0.9.0/share/nvim/runtime/lua/vim/treesitter.lua:215: attempt to index local 'node' (a nil value)
stack traceback:
        ...r/neovim/0.9.0/share/nvim/runtime/lua/vim/treesitter.lua:215: in function 'get_range'
        ...r/neovim/0.9.0/share/nvim/runtime/lua/vim/treesitter.lua:251: in function '_get_node_text'
        ...goimpl.nvim/lua/telescope/_extensions/goimpl_builtin.lua:123: in function 'goimpl'
        ...goimpl.nvim/lua/telescope/_extensions/goimpl_builtin.lua:190: in function 'run_replace_or_original'
        ...re/nvim/lazy/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'run_replace_or_original'
        ...re/nvim/lazy/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'
        ...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:253: in function <...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:252>
crayonwow commented 1 year ago

i prepared a PR that fixes it

13

edolphin-ydf commented 1 year ago

Thanks for the pr