Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Update Tree-sitter syntax highlighting synchronously for parses that complete sync #17923

Merged
merged 8 commits into from
Aug 24, 2018

Conversation

maxbrunsfeld
Copy link
Contributor

@maxbrunsfeld maxbrunsfeld commented Aug 24, 2018

The Background

In #17339, I moved Tree-sitter's parsing to a background thread, but allowed a limited amount of parsing work to be done on the main thread. But even if the parsing completed on the main thread, the syntax tree would be returned via an async method.

While working on #17879, I noticed that this asynchronous behavior was somewhat inconvenient. Some tests failed because the syntax tree wouldn't update until the next tick after a small text change.

The Fix

In this PR, I've updated the TreeSitterLanguageMode so that in the case where parsing completes synchronously, the language mode's state will be updated synchronously too.

I've also fixed a number of other small bugs in TreeSitterLanguageMode that showed up in the test suite during #17339.

Refs tree-sitter/node-tree-sitter#26

@maxbrunsfeld maxbrunsfeld force-pushed the mb-tree-sitter-sync-updates branch from 511adda to a652e0a Compare August 24, 2018 17:29
@maxbrunsfeld maxbrunsfeld force-pushed the mb-tree-sitter-sync-updates branch from a652e0a to 4d3a9ec Compare August 24, 2018 17:37
@maxbrunsfeld maxbrunsfeld merged commit bc00369 into master Aug 24, 2018
@maxbrunsfeld maxbrunsfeld deleted the mb-tree-sitter-sync-updates branch August 28, 2018 21:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant