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
feat(treesitter): async parsing #22420
base: master
Are you sure you want to change the base?
Conversation
69de08c
to
3766468
Compare
This is great, does it still also make sense to max out at 'redrawtime'? #19812 |
There will be two timeouts to consider:
I think With that said, the default value of Or maybe conflating this with |
That's what I was thinking... the total time should have an upper limit, it's equivalent to the user hitting ctrl-c. |
7f758f3
to
4d78b73
Compare
5832f83
to
f3194d2
Compare
dde64ff
to
2701b96
Compare
dc2c9d9
to
6387ddd
Compare
Status updateThis PR sort of works as is, however I've found that Treesitter's parser timeout doesn't work when trying to parse the big linux file. I'm fairly confident this is a Treesitter issue, but in order to get any insight into what's happening I've raised #23638 so we can see Treesitters internal logging. |
This comment was marked as off-topic.
This comment was marked as off-topic.
480f934
to
83e9f4c
Compare
83e9f4c
to
31bf60b
Compare
Idea
Use
TSParser:set_timeout
to set the maximum time to parse each event-loop iteration. If the timeout is reach, parsing will be deferred and resumed at a later point in the event loop. This should result in less editor blocking and lag, especially during the initial load of a buffer.TSParser:parse()
will come in two variants:To enable:
Notes
As the synchronous version of
parse
will still be supported, this'll mean any plugins calling the synchronous version will now block the UI instead of highlighter, so they will all have to adapt to the async version in order to not negate the benefits of this PR.How does
'redrawtime'
fit into this? Or does it not?How do we handle subsequent calls to
parse
whilst one is in-progress?For subsequent calls, don't run the parse again, but save the callback and call it when the currently running parse completes. If a synchronous parse is requested, we cancel the async one in flight.