Closed Wouter01 closed 9 months ago
Thank you for reporting this. Probably a bug - investigating now.
Ok so this is a bug. Even though synchronous access with the .required
fill mode is specified, BackgroundingLanguageLayerTree.accessTreeSynchronously
is returning false, disallowing the synchronous access.
So far, this is a valid situation. You've asked for synchronous access, and that access is impossible. But, it should not be in this situation. I think this is because the pendingWork
calculation is too simplistic.
Thank you for looking into it! I can confirm that it does work if I use the asynchronous methods. Does this mean I should hold off of using the synchronous methods for now? Or is there a case where they work as expected?
With the code currently on main, any synchronous work that requires parsing will fail. I'm working on a fix, but I also want to make a test and getting that working has been a chain reaction of problems...
Ok, I think this is fixed now. It took a long time because I added a test, but that test didn't work because a whole bunch of stuff went wrong with accessing Swift tree-sitter highlights. https://github.com/alex-pinkus/tree-sitter-swift/issues/289
Yep, all working now. Thank you for the quick fix!
I'm trying to use the example code provided in the repo. For some reason that is not clear to me, the following line will return nil (and in the example case, crash because it's force unwrapped)
I had a look at the code but couldn't find an immediate cause for it. I'm using the main branch to test this, as it's the one used in the example code.
I also tried using the sample project. There, the TextViewHighlighter example seems to work as expected. The other method provided (setUpTreeSitter) has the same issue though.
Am I doing anything wrong here? Or should I stick with 0.6.0 for now?