-
-
Notifications
You must be signed in to change notification settings - Fork 45
Dynamic update support #69
Comments
It should update dynamically. As soon as you exit insert mode, nvim-gps asks treesitter for new information to show. It seems that for some reason your treesitter isn't providing latest information 🤔 2022-02-08.11-11-02.mp4 |
Hmm interesting. I am new to treesitter, so have no concrete ideas yet on how to debug this. FYI, my treesitter parser and plugins are up-to-date (and neovim is nightly-master). I have nothing special in my config, and The |
@SmiteshP Is treesitter-playground as well automatically updating as you change the text? |
Yep, playground should also update on the fly. So this means the issue is definitely with treesitter. You could try opening a issue on nvim-treesitter repo, they should be able to help. |
Surprisingly, nvim-treesitter/playground#64 says that currently the module |
@SmiteshP So according to the discussion nvim-treesitter/nvim-treesitter#2492 (-> nvim-treesitter/playground#64), it seems calling the parser to update the syntax tree for the current buffer (i.e., I can confirm that adding the following lines somewhere in + -- Request treesitter parser to update the syntax tree.
+ local parser = ts_parsers.get_parser(vim.fn.bufnr(), filelang)
+ parser:parse()
local current_node = ts_utils.get_node_at_cursor() But this would be too excessive, frequent call because |
Whenever get_location() is called, we request the treesitter parser to refresh the parse tree for the current buffer up to date. This may be not needed when the treesitter-highlight module is enabled, but when the module is disabled the plugin may not display the correct context information (as reported in SmiteshP#69). Such calls will be throttled properly: refreshing the treesitter parse tree will happen only when the buffer has changed.
@SmiteshP So the conclusion is that ensuring the parse tree to be up-to-date is an responsibility of downstream treesitter module/plugin, which is however often subsumed when the treesitter |
Oh interesting! I did use to have an |
It looks like that the context is not automatically updated while editing. Until I reload the file (so that GPS query can refresh), nvim-gps fails to show the context for newly added scopes.
It would be great if we can support dynamic update of the context information powered by treesitter!
The text was updated successfully, but these errors were encountered: