-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add Syntax::layers_for_byte_range
#9
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
base: master
Are you sure you want to change the base?
Conversation
We should avoid the Vec if we can and have this be an iterator instead. Alternatively we could expose |
I assume you'd like to avoid the Vec to not have to make extra allocations? |
Also I'm curious why did you choose to receive |
The `Syntax` for these does not not include these languages, so it is not correct to test for them
When I tried to migrate the comment continuation PR (helix-editor/helix#12759) to use the new tree-house bindings, I encountered a problem:
When continuing comments, we look at the smallest injection layer that includes the selection. This layer is the
comment
language itself, which has no tokens. We need to ignore it and try the next layer. But there's no way to do that currentlyI think returning a list of layers from largest to smallest that include the byte range is a good API for tree-house
I updated my helix PR to make use of this PR: https://github.com/helix-editor/helix/blob/f07e6973fedb2fed4ff7f0e1a9d166bea7bedcab/helix-core/src/comment.rs#L58-L77
Public API