CodeEditApp / CodeEditSourceEditor

A code editor view written in Swift powered by tree-sitter.
https://codeeditapp.github.io/CodeEditSourceEditor/documentation/codeeditsourceeditor
MIT License
514 stars 80 forks source link

TreeSitter Tag Auto Close #250

Closed thecoolwinter closed 4 months ago

thecoolwinter commented 4 months ago

Description

Fixes a few bugs with #247 and converts it to use tree-sitter rather than a regex-based implementation. This should be faster on larger documents and makes it more robust to edge cases in tag regexes. This also handles newlines correctly, as the old PR caused the editor to no longer be able to delete newlines

Also fixes a small bug in the TreeSitterClient that caused every query to be dispatched to main asynchronously. This was the cause for a few visual oddities like flashing colors when changing themes. This also improves highlighting while scrolling fast as most highlights are processed synchronously.

Related Issues

Checklist

Screenshots

https://github.com/CodeEditApp/CodeEditSourceEditor/assets/35942988/8fc559a4-15c9-4b4e-a3aa-57c86c57f7c9

https://github.com/CodeEditApp/CodeEditSourceEditor/assets/35942988/a209b40f-7aa3-4105-aa37-5608e8b4bcdb