CodeEditApp / CodeEditSourceEditor

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

✨ Incremental Syntax Highlighting #27

Closed lukepistrol closed 2 years ago

lukepistrol commented 2 years ago

At the moment each keystroke triggers highlighting for the whole document. While this is not an issue for small documents this might bring big performance losses on larger documents.

Though there needs to be some kind of padding of the changed text range since a single character cannot be parsed to anything. Ideally this would be the entire current line.

Ideally:

Alternatively:

austincondiff commented 2 years ago

@lukepistrol From what I understood, a key advantage tree sitter provides is highlighting in the scope of the change, not necessarily the current line itself. Is this something we could instead do?