What do you think about that neovim feature? #1831
Replies: 1 comment 2 replies
-
I'll have a think about this. I'm not 100% sure this would be a huge help, but an AST would get rid of some of the more "hack" things I've needed to do. But I'll give you a sense of how I think about this for neogit, and you can tell me your thoughts. First, check out the "renderer" module. It takes a tree of components (something defined in the code base - text, row, column primitives) and turns that into a tree of nodes, highlight ranges, fold locations, and some fast lookup tables connecting the ui "objects" to data. Think being able to find "what is the git object id of the thing I am selecting" or "what is the starting line and ending line of the diff my cursor is in". The latter I think pretty cleanly maps to your proposal. For large buffers (log view with many entries) just applying highlights takes a considerable proportion of the render time. Having a way to hand highlighting off to the "syntax" instead of relying on the api might be a big win in that case. I don't think I could hand off folding, since we create "fake" folds for hunks, lazy loading them the first time a user "unfolds" the region. After rendering its a normal fold. But we would need to track that state. One aspect that may be helped by a proper AST would be just updating parts of a buffer on rerender, instead of throwing the whole thing out each refresh. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! Since you are the plugin author, who might be interested in the
features that I propose, could you send some feedback on the issue
below (I mean in that issue's page)?
Feature: Treesitter features for non existent (anonymous) grammar/static AST
neovim/neovim#35907
This question should be closed.
Beta Was this translation helpful? Give feedback.
All reactions