New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support imenu-like feature #1
Comments
I duplicated the buffer content a bunch of times and got a 1k line buffer, then tried the code again. It is still pretty fast, took about 0.1 sec. I think we can probably get away with this approach :-) Add an idle-timer, |
I will investigate if your code is faster than the dynamic module option. I mean, it almost certainly is. However, the example I gave is of course just a simplified version of the actual tree generator which is primarily -- but not only -- designed for echo area navigational aid as you traverse your code. See: Now this is the hacky version; the original rendered a proper subset of the sparse tree but that of course (with ETS) turned out to have some performance bottlenecks. This simplified version is probably 'good enough' though. |
Ah, I see, very interesting feature indeed. I'll wait for you result. If it is still not fast enough, you can describe what you do in more detail, and hopefully we can come up with something in C that can boost the performance for this type use use case. |
while I'm excited to see tree-sitter getting integrated into the Emacs core, I'd very much like the default imenu integration to be synchronous (but fast) and not do anything in the background that might lead to ~100ms latency spikes. Note that I'm not currently trying to extract scopes, and I'm not sure if that can be done within tree-sitter's query mechanism or if one would have to manually traverse the AST starting from matched nodes (assuming that is supported by the API). Would that be a major performance bottleneck? For completeness, this is the primitive implementation I'm using (hence the
|
Yes, if we do provide a default tree-sitter imenu integration, it would be like what you showed here. I don't think imenu support scope anyway. |
I mean, |
glad to hear that, no reason for me to worry then :) |
Currently the best idea I can come up with is to periodically query the whole buffer and refresh the tree view. For example, in a Python buffer
Evaluating
displays
The text was updated successfully, but these errors were encountered: