ray-x / go.nvim

G'day Nvimer, Joyful Gopher: Discover the Feature-Rich Go Plugin for Neovim
MIT License
1.91k stars 119 forks source link

Crash with latest treesitter #423

Closed lespea closed 5 months ago

lespea commented 5 months ago

Details at https://github.com/nvim-treesitter/nvim-treesitter/issues/5960

Error detected while processing CursorMoved Autocommands for "<buffer=3>":                                                                                                                                                                                                                                                      
E5108: Error executing lua ...nvim/lazy/nvim-treesitter/lua/nvim-treesitter/locals.lua:58: attempt to index field 'local' (a nil value)                                                                                                                                                                                         
stack traceback:                                                                                                                                                                                                                                                                                                                
        ...nvim/lazy/nvim-treesitter/lua/nvim-treesitter/locals.lua:58: in function 'get_scopes'                                                                                                                                                                                                                                
        ...nvim/lazy/nvim-treesitter/lua/nvim-treesitter/locals.lua:277: in function 'containing_scope'                                                                                                                                                                                                                         
        ...lua/nvim-treesitter-refactor/highlight_current_scope.lua:16: in function 'highlight_current_scope'                                                                                                                                                                                                                   
        [string ":lua"]:1: in main chunk  

From clason:

Make sure that ray-x/go.nvim has updated their queries; there were breaking changes that you should be following.

ahorine commented 5 months ago

@lespea My PR should fix local nil indexing crashes like this if you want to give it a try. The resulting errors I was experiencing appear to match this one, though the source was different, so it could be worth double checking with your config as well.

ray-x commented 5 months ago

They are different issues. A report submitted here: https://github.com/nvim-treesitter/nvim-treesitter/issues/6037

ahorine commented 5 months ago

In this commit all of the local matches were placed into a "local" subtable group. The name, start, and type matches in your example all come from the extensions added in this plugin that didn't have the new formatting. I don't think this is a treesitter issue, but rather as clason mentioned there are new rules for query structuring.

rodhash commented 2 months ago

I just had this error..

It seems this issue still happens when I'm editing a .norg or .md file and then I open a new buffer with a .go file. When opening directly a .go file this issue doesn't happen.

Well not sure if this is the same error actually, let me provide the error msg:

TS error: Error detected while processing CursorMoved Autocommands for "<buffer=10>":

E5108: Error executing lua ...-a84b454/share/nvim/runtime/lua/vim/treesitter/query.lua:248: Query error at 4:2. Invalid node type "method_spec":
(method_spec
 ^

stack traceback:
    [C]: in function '_ts_parse_query'
    ...-a84b454/share/nvim/runtime/lua/vim/treesitter/query.lua:248: in function 'fn'
    ...dev-a84b454/share/nvim/runtime/lua/vim/func/_memoize.lua:54: in function 'fn'
    ...dev-a84b454/share/nvim/runtime/lua/vim/func/_memoize.lua:54: in function 'get_query'
    .../nvim/lazy/nvim-treesitter/lua/nvim-treesitter/query.lua:108: in function 'get_query'
    .../nvim/lazy/nvim-treesitter/lua/nvim-treesitter/query.lua:201: in function 'prepare_query'
    .../nvim/lazy/nvim-treesitter/lua/nvim-treesitter/query.lua:397: in function 'iter_group_results'
    .../nvim/lazy/nvim-treesitter/lua/nvim-treesitter/query.lua:409: in function 'collect_group_results'
    .../nvim/lazy/nvim-treesitter/lua/nvim-treesitter/query.lua:48: in function 'update_cached_matches'
    .../nvim/lazy/nvim-treesitter/lua/nvim-treesitter/query.lua:59: in function 'get_locals'
    ...nvim/lazy/nvim-treesitter/lua/nvim-treesitter/locals.lua:53: in function 'get_scopes'
    ...nvim/lazy/nvim-treesitter/lua/nvim-treesitter/locals.lua:278: in function 'containing_scope'
    ...lua/nvim-treesitter-refactor/highlight_current_scope.lua:16: in function 'highlight_current_scope'
    [string ":lua"]:1: in main chunk
rodhash commented 2 months ago

Oh nevermind

I forgot I locked my go.nvim to TAG v0.2.0 because of the "inlay" issue inlay_hint.lua:365: enable: expected boolean, got table .. I guess I went back too much in the "go.nvim" history lol

On commit cbc6aca things are running fine I guess, this issue is not happening neither the "inlay" one

ps: right now I can't use the latest nvim nightly because it introduces a more annoying issue IMO where it doesn't show up my "horiz" char from fillchars. Usually I split my screen quite often and things get a bit weird without a line between them.

ray-x commented 2 months ago

I agree there might be breaking changes if pinned to nightly. I also need to roll back from time to time.